Skip to content

Commit

Permalink
don't build label on missing package digests
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanmars committed Dec 10, 2024
1 parent 792f00f commit 2d58aab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44272,6 +44272,7 @@ class CleanupTask {
label = `architecture: ${label}`;
}
else {
// unknown
// check if it's a buildx attestation
const manifest = await this.registry.getManifestByDigest(imageManifest.digest);
// kinda crude
Expand Down Expand Up @@ -44700,7 +44701,9 @@ class CleanupTask {
if (manifest.manifests) {
for (const imageManifest of manifest.manifests) {
// call the buildLabel method which will prime manifest if its needed
await this.buildLabel(imageManifest);
if (this.packageRepo.getDigests().has(imageManifest)) {
await this.buildLabel(imageManifest);
}
}
}
// process tagged digests (referrers)
Expand All @@ -44713,7 +44716,9 @@ class CleanupTask {
const tagManifest = await this.registry.getManifestByDigest(tagDigest);
if (tagManifest.manifests) {
for (const manifestEntry of tagManifest.manifests) {
await this.buildLabel(manifestEntry);
if (this.packageRepo.getDigests().has(manifestEntry)) {
await this.buildLabel(manifestEntry);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/cleanup-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export class CleanupTask {
}
label = `architecture: ${label}`
} else {
// unknown
// check if it's a buildx attestation
const manifest = await this.registry.getManifestByDigest(
imageManifest.digest
Expand Down Expand Up @@ -814,7 +815,9 @@ export class CleanupTask {
if (manifest.manifests) {
for (const imageManifest of manifest.manifests) {
// call the buildLabel method which will prime manifest if its needed
await this.buildLabel(imageManifest)
if (this.packageRepo.getDigests().has(imageManifest)) {
await this.buildLabel(imageManifest)
}
}
}
// process tagged digests (referrers)
Expand All @@ -828,7 +831,9 @@ export class CleanupTask {
await this.registry.getManifestByDigest(tagDigest)
if (tagManifest.manifests) {
for (const manifestEntry of tagManifest.manifests) {
await this.buildLabel(manifestEntry)
if (this.packageRepo.getDigests().has(manifestEntry)) {
await this.buildLabel(manifestEntry)
}
}
}
}
Expand Down

0 comments on commit 2d58aab

Please sign in to comment.