Skip to content

fix(ci): digest-aware GHCR RC cleanup with loud verification - #584

Merged
c-vigo merged 5 commits into
devfrom
bugfix/583-ghcr-rc-cleanup
Jun 10, 2026
Merged

c-vigo merged 5 commits into
devfrom
bugfix/583-ghcr-rc-cleanup

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes recurring silent failure of the promote-release.yml GHCR RC cleanup job. RC image tags (X.Y.Z-rc*) were never deleted because RELEASE_APP lacked package-admin permission (GitHub returns misleading HTTP 404). The job also used a blanket sha256-* rule that would delete live release cosign signatures once permissions were fixed.

This PR switches GHCR deletes to GITHUB_TOKEN (with repo Admin on the package), adds digest-aware RC/signature selection via a bats-tested script, and makes the cleanup step fail loudly when RC tags remain.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • .github/scripts/select-ghcr-prune-targets.sh — jq-driven selection of RC image versions and matching RC cosign signatures; preserves published release signatures
  • .github/workflows/promote-release.yml — GHCR prune step uses GITHUB_TOKEN, calls selection script, idempotent delete with post-pass verification (fails step on leftovers)
  • tests/bats/select-ghcr-prune-targets.bats + tests/bats/fixtures/ghcr-versions.json — bats coverage for selection logic
  • docs/RELEASE_CYCLE.md, docs/DOWNSTREAM_RELEASE.md — document GITHUB_TOKEN + package Admin grant requirement

Changelog Entry

### Fixed

- **GHCR RC artifacts never pruned after promote-release** ([#583](https://github.com/vig-os/devcontainer/issues/583))
  - Switch GHCR package-version deletes to `GITHUB_TOKEN` with repo Admin on the `devcontainer` package (one-time Manage Actions access grant)
  - Replace blanket `sha256-*` deletion with digest-aware selection that prunes RC images and matching RC cosign signatures only
  - Fail the cleanup step loudly when deletes fail or RC tags remain (job still uses `continue-on-error`)

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • npx bats tests/bats/select-ghcr-prune-targets.bats — 4/4 green
  • Package Admin grant applied manually on ghcr.io/vig-os/devcontainer (Manage Actions access → vig-os/devcontainer → Admin)
  • Existing RC image tags (0.3.5-rc1*, 0.3.4-rc1*) manually pruned from GHCR

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

One-time manual prerequisite (already done): Package settings → Actions access → add vig-os/devcontainer with role Admin on the devcontainer GHCR package. Without this grant, cleanup will fail visibly (red job) on the next promote.

Refs: #583

@c-vigo c-vigo self-assigned this Jun 10, 2026
@c-vigo
c-vigo merged commit aab889f into dev Jun 10, 2026
14 checks passed
@c-vigo
c-vigo deleted the bugfix/583-ghcr-rc-cleanup branch June 10, 2026 12:43
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.

1 participant