Skip to content

Commit

Permalink
use single digest list for prime
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanmars committed Dec 10, 2024
1 parent 2d58aab commit 123416d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44272,7 +44272,6 @@ 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 @@ -44696,12 +44695,13 @@ class CleanupTask {
// process runs. ensuring only package api calls are made during deletion
// minimizing chances of failed registry calls affecting deletion
async primeManifests() {
const digests = this.packageRepo.getDigests();
for (const digest of this.deleteSet) {
const manifest = await this.registry.getManifestByDigest(digest);
if (manifest.manifests) {
for (const imageManifest of manifest.manifests) {
// call the buildLabel method which will prime manifest if its needed
if (this.packageRepo.getDigests().has(imageManifest)) {
if (digests.has(imageManifest)) {
await this.buildLabel(imageManifest);
}
}
Expand All @@ -44716,7 +44716,7 @@ class CleanupTask {
const tagManifest = await this.registry.getManifestByDigest(tagDigest);
if (tagManifest.manifests) {
for (const manifestEntry of tagManifest.manifests) {
if (this.packageRepo.getDigests().has(manifestEntry)) {
if (digests.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.

6 changes: 3 additions & 3 deletions src/cleanup-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ 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 @@ -810,12 +809,13 @@ export class CleanupTask {
// process runs. ensuring only package api calls are made during deletion
// minimizing chances of failed registry calls affecting deletion
async primeManifests(): Promise<void> {
const digests = this.packageRepo.getDigests()
for (const digest of this.deleteSet) {
const manifest = await this.registry.getManifestByDigest(digest)
if (manifest.manifests) {
for (const imageManifest of manifest.manifests) {
// call the buildLabel method which will prime manifest if its needed
if (this.packageRepo.getDigests().has(imageManifest)) {
if (digests.has(imageManifest)) {
await this.buildLabel(imageManifest)
}
}
Expand All @@ -831,7 +831,7 @@ export class CleanupTask {
await this.registry.getManifestByDigest(tagDigest)
if (tagManifest.manifests) {
for (const manifestEntry of tagManifest.manifests) {
if (this.packageRepo.getDigests().has(manifestEntry)) {
if (digests.has(manifestEntry)) {
await this.buildLabel(manifestEntry)
}
}
Expand Down

0 comments on commit 123416d

Please sign in to comment.