Merge cosign check and notation check (#19079)

1.Merge cosign check and notaion check into one API call, related issue #19077

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-08-03 13:06:15 +08:00 committed by GitHub
parent 1132a6654e
commit cdd3f267b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 36 deletions

View File

@ -343,16 +343,16 @@
</clr-dg-cell>
<clr-dg-cell>
<span
*ngIf="artifact.coSigned === 'checking'"
*ngIf="artifact.signed === 'checking'"
class="spinner spinner-inline ml-2"></span>
<clr-icon
shape="check-circle"
*ngIf="artifact.coSigned === 'true'"
*ngIf="artifact.signed === 'true'"
size="20"
class="signed"></clr-icon>
<clr-icon
shape="times-circle"
*ngIf="artifact.coSigned === 'false'"
*ngIf="artifact.signed === 'false'"
size="16"
class="color-red"></clr-icon>
</clr-dg-cell>

View File

@ -881,8 +881,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
projectName: this.projectName,
repositoryName: dbEncodeURIComponent(this.repoName),
reference: item.digest,
withSignature: true,
withImmutableStatus: true,
page: 1,
pageSize: 8,
};
@ -935,43 +933,30 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
if (artifacts) {
if (artifacts.length) {
artifacts.forEach(item => {
item.coSigned = CHECKING;
const listTagParams: NewArtifactService.ListAccessoriesParams =
{
item.signed = CHECKING;
this.newArtifactService
.listAccessories({
projectName: this.projectName,
repositoryName: dbEncodeURIComponent(this.repoName),
reference: item.digest,
page: 1,
pageSize: ACCESSORY_PAGE_SIZE,
};
forkJoin([
this.newArtifactService.listAccessories({
...listTagParams,
q: encodeURIComponent(
`type=${AccessoryType.COSIGN}`
`type={${AccessoryType.COSIGN} ${AccessoryType.NOTATION}}`
),
}),
this.newArtifactService.listAccessories({
...listTagParams,
q: encodeURIComponent(
`type=${AccessoryType.NOTATION}`
),
}),
]).subscribe({
next: res => {
if (
res?.length &&
(res[0]?.length || res[1]?.length)
) {
item.coSigned = TRUE;
} else {
item.coSigned = FALSE;
}
},
error: err => {
item.coSigned = FALSE;
},
});
})
.subscribe({
next: res => {
if (res?.length) {
item.signed = TRUE;
} else {
item.signed = FALSE;
}
},
error: err => {
item.signed = FALSE;
},
});
});
}
}

View File

@ -9,7 +9,7 @@ export interface ArtifactFront extends Artifact {
pullCommand?: string;
annotationsArray?: Array<{ [key: string]: any }>;
tagNumber?: number;
coSigned?: string;
signed?: string;
accessoryNumber?: number;
}