Skip to content

fix(delete-previous-head-image): keep referrers of retained manifests - #356

Merged
vcauesantos merged 2 commits into
mainfrom
devops-1831/referrer-after-keepset
Nov 13, 2026
Merged

vcauesantos merged 2 commits into
mainfrom
devops-1831/referrer-after-keepset

Conversation

@Piotr1215

@Piotr1215 Piotr1215 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What happened

#347 stopped the cleanup from deleting the signatures of a manifest shared with a tagged image. One case was still open.

The action decided which signatures to keep before it asked the GitHub packages API about tags. Some tags only show up there, such as debug. A platform manifest kept because of one of those tags stayed in GHCR, but its signature and its sha256-<digest> referrer index were still deleted.

A dry run with fakes against 44da6a8 showed this: it kept the debug manifest and planned to delete its referrer index and signature.

Nothing is affected today, because candy signs only the image index. A caller that signs each platform would lose those signatures.

What this PR changes

Signatures are protected after the full keep list is known. The action first collects every manifest it keeps, for any reason: still reachable from a tag, carrying a tag only the packages API shows, or having no package version. Then it keeps the signatures and referrer indexes of all of them. The delete order does not change: leaves first, the image index last.

A manifest with no package version now keeps its signatures too. Before, they were deleted. The action cannot delete that manifest, so leaving its signatures behind matches everything else it keeps.

The README says this. It now states that every kept manifest keeps its signatures and attestations, whatever the reason it was kept.

The step summary names the new reason as refers to kept manifest <digest>.

How it was tested

  • A new test keeps a platform manifest through a debug tag that only the packages API shows. It checks that the manifest, its referrer index and its signature all stay, and that the rest of the old image is deleted. It runs for both a real delete and a dry run.
  • The new test fails on both runs against the code on main and passes with this change.
  • make test-delete-previous-head-image: 24 passed, after rebasing onto main.

After merge, delete-previous-head-image/v1 moves to the merge commit so callers pick up the fix.

Closes DEVOPS-1831

@Piotr1215
Piotr1215 requested a review from a team as a code owner November 6, 2026 08:51
Piotr1215 and others added 2 commits November 13, 2026 12:55
A packages-only tag can retain a platform manifest after referrer protection has already run, leaving its signatures eligible for deletion. Compute retained manifests first so their referrers survive cleanup.
@vcauesantos
vcauesantos force-pushed the devops-1831/referrer-after-keepset branch from 4c73800 to 900f0aa Compare November 13, 2026 18:55
@vcauesantos
vcauesantos merged commit d9fb69e into main Nov 13, 2026
6 checks passed
@vcauesantos
vcauesantos deleted the devops-1831/referrer-after-keepset branch November 13, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants