Automate clean-up of Attestations
Maintainers usually reply within 1 day
@rjaegers is already working on this.
Since Mar 13, 2026.
- #1200 by @copilot-swe-agent — closed without merging
Assessment
This issue has not been assessed yet.
Description
Goal and agreed policy
Extend image cleanup to remove obsolete GitHub artifact attestations without breaking verification of supported images.
The retention policy is:
| Subject | Policy |
|---|---|
| Images belonging to a published GitHub release, including prereleases | Preserve their attestations indefinitely |
| Images for an open pull request | Preserve while the PR is open |
Current default-branch edge image |
Preserve |
| Other, obsolete builds | Eligible only after a seven-day grace period |
This replaces the ambiguous original reference to "release branches". A release tag or draft release alone does not confer indefinite retention. Published-release protection takes precedence even if the image later disappears from the registry. Never delete or modify published release assets.
Current implementation and starting points
Inspected at af840070c907d71ce06334ea65eded00dc3946a4; recheck the implementation before starting.
.github/workflows/image-cleanup.yml: weekly/manual cleanup usingdataaxiom/ghcr-cleanup-action, deleting untagged and orphaned images..github/workflows/pr-image-cleanup.yml: closed-PRpr-<number>image cleanup and separate cache cleanup..github/workflows/wc-build-push.yml: creates index-level GitHub provenance and pushes it to the registry; BuildKit also generates SBOM material.- Package scope:
amp-devcontainer,amp-devcontainer-base,amp-devcontainer-cpp,amp-devcontainer-docs,amp-devcontainer-embedded-cpp,amp-devcontainer-embedded-rust,amp-devcontainer-rust.
GitHub attestation records, OCI registry attestations/referrers, and release assets are different storage surfaces. Removing one does not prove that the others were removed.
Implementation requirements
- Establish a supported, repository-scoped inventory and authentication path first. Document how existing attestations and their subjects are discovered, including historical orphans whose images have already disappeared. Digest lookup alone cannot discover unknown digests. Check pagination, API availability, and the actual minimum token permissions with a disposable fixture before enabling deletion. If historical discovery is incomplete, report that explicitly rather than claiming a complete cleanup.
- Resolve a protected set from published releases, open PRs, and current
edge, across all packages. Use immutable digests, not tag-name matching alone. Walk multi-platform indexes to include child manifests and associated evidence. Preserve shared digests if any protected reference reaches them. - Keep a durable, auditable release-to-digest mapping at publication if existing metadata cannot reconstruct it reliably. Bootstrap older published releases conservatively; unresolved mappings block affected deletions. A short-lived workflow artifact is not an indefinite-retention record.
- Require at least seven days since a candidate was first confirmed obsolete/unprotected, and at least seven days since its attestation was created. Closing a PR or advancing
edgestarts the grace period; it must not trigger immediate deletion. Treat in-flight builds as protected and recheck protection immediately before deleting. - Reconcile with existing image cleanup so the order does not destroy the information needed to classify attestations. A missing image is not sufficient justification to delete published-release evidence. Unknown tags, malformed metadata, incomplete pagination, authentication failures, rate limits, registry errors, or ambiguous ownership must result in retention and a diagnostic, not inferred absence.
- Apply the same policy to provenance and SBOM predicates, including the attestations introduced by philips-software/amp-devcontainer#1135. If an attestation covers multiple subjects, preserve the entire record when any subject is protected.
- Prefer deletion by validated attestation ID over organization-wide digest deletion. Verify repository ownership explicitly; identical digests may occur in other repositories. Preserve registry referrers needed by protected images and identify which registry-side cleanup is already handled by the existing action.
- Provide a dry-run mode reporting keep/delete/unknown decisions, subject digest, attestation ID, reason, and grace-period status. Roll out with a reviewed dry run before enabling scheduled deletion. Export candidate bundles and a deletion manifest before applying changes; document their retention and the limits of recovery.
- Keep cleanup bounded, idempotent, and safe to rerun after partial failures. Use least privilege, pinned actions, existing workflow conventions, and safe handling of event/API data. Do not execute code from a closed PR with elevated credentials. A scheduled sweep must handle cases where a fork PR's close event cannot obtain deletion permissions.
Do not silently expand this into organization-wide cleanup, deletion of valid release evidence, or changing the image retention policy.
Required tests
Use fixtures and a disposable integration target, not production release deletions:
- Published release survives indefinitely, including a missing registry image and shared release/PR/edge digest.
- Open PR and current
edgesurvive; closed PR and superseded edge survive until the full grace period expires. - Old draft/tag-only build has no indefinite exemption, but an active build is not deleted.
- Boundary times, publication/reopening/edge changes between planning and deletion, multi-platform children, referrers, multiple subjects, and multiple predicates.
- Unrelated repository with the same digest is untouched.
- Missing/ambiguous release mappings, paginated results, 403/404 ambiguity, 429/5xx, registry failures, and interrupted/repeated runs fail safely.
- Dry run performs zero deletions; apply deletes only approved eligible fixtures; protected image verification still succeeds afterward.
Acceptance criteria
- The agreed policy and grace-period semantics are documented and automated for every in-scope package.
- Discovery coverage and minimum permissions are demonstrated; historical gaps are resolved or explicitly block unsafe deletion.
- Published-release evidence is protected independently of moving tags and registry availability.
- GitHub and registry cleanup responsibilities are explicit; both provenance and SBOM evidence follow one policy.
- Automated positive/negative tests pass, and a reviewed dry-run report precedes scheduled apply.
- Logs/exported manifests support auditing; partial failures are visible and do not widen deletion scope.
Dependencies and references
No dependency on philips-software/amp-devcontainer#1135: implement predicate-independent retention now; that issue integrates its new SBOM records with this policy.
- GitHub attestation lifecycle guidance
- Repository attestation lookup API
- Organization attestation APIs, including
DELETE /orgs/{org}/attestations/{attestation_id}. Validate authentication support; do not assume the image cleanup token already suffices.
- Dominant language
- Shell
- Stars
- 136
- Forks
- 8
- Avg merge
- 17h 19m
- Merged PRs (30d)
- 53
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from philips-software/amp-devcontainer
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
philips-software/amp-devcontainer#1571 ·
Maintainers usually reply within 1 day
-
Inventory smoke tests can hang despite command timeout; fail with bounded diagnosticsPossibly taken @rjaegers claimed this 23 days ago. Open
philips-software/amp-devcontainer#1569 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
scheduled stale tool-versions
Difficulty 4/5 3-5 days Newbie friendliness 48/100
philips-software/amp-devcontainer#1475 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
philips-software/amp-devcontainer#1433 · 1 comment ·
Maintainers usually reply within 1 day
-
scheduled tool-versions
Difficulty 4/5 3-5 days Newbie friendliness 48/100
philips-software/amp-devcontainer#1222 ·
Maintainers usually reply within 1 day
All issues in philips-software/amp-devcontainer
Similar issues
-
documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-networking-best-practices#256 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
smores56/homelab-platform#289 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day