Skip to content

ci(cleanup): prune untagged GHCR images and old attestation tags #4816

Open

Description

@devops-cli-service

Problem

  • Nothing deletes old versions of the service, runner and mcp-server packages. About 14 releases a day each add a version tag and an attestation tag (sha256-...) to each package. On 2026-11-19 GHCR listed: service 717 tags (358 v*, 358 sha256-), runner 597 (298 v, 298 sha256-), mcp-server 263 (131 v, 131 sha256-), devcontainer 736 (385 v, 349 sha256-*, latest, buildcache). The compressed amd64 sizes of latest are service 455 MB, runner 727 MB, mcp-server 765 MB and devcontainer 2524 MB.
  • .github/workflows/cleanup-devcontainer.yml covers the devcontainer package only. Its pr-* tag code (about 50 lines of bash at :40-89) has no target, because no workflow pushes those tags since fix(devcontainer): the published image applies the devcontainer features again, so remoteUser vscode exists #1895. Its useful part is delete-untagged for one package.
  • After ci(release): push each image once, then verify and tag that digest #6407 (push once by digest), a failed verify leaves an untagged digest in the public package.

Change

Owner decision of 2026-11-19: GHCR retention keeps the release tags and deletes untagged images and sha256-* attestation tags older than 30 days. This replaces the earlier plan of this issue (delete the workflow).

  • Change cleanup-devcontainer.yml into one GHCR retention workflow for the four packages with dataaxiom/ghcr-cleanup-action (already pinned at cleanup-devcontainer.yml:92): packages: devops-cli/devcontainer,devops-cli/service,devops-cli/runner,devops-cli/mcp-server, delete-untagged: true, delete-tags: sha256-*, older-than: 30 days, exclude-tags: latest,buildcache,v*, delete-orphaned-images: true and delete-ghost-images: true. Keep the daily schedule and the dry_run input.
  • Delete the pr-* tag resolution and the open-PR query (:40-89).
  • The :buildcache tags of perf(ci): keep the image build cache in GHCR #6404 stay.
  • Update the workflow permission test and the documents that name the old workflow.
  • The agent token has no read:packages scope, so a person runs the workflow once with dry_run: true and checks the list before the first real run.

Renovate. The action stays SHA-pinned. The github-actions manager updates it.

Risk. A deleted sha256-* tag removes the attestation manifest of that image from the registry. Check in the PR that uv run devops gh attestation verify of a v* tag older than 30 days still passes, because it reads the GitHub attestation store. If it fails, keep the sha256-* tags of the release tags and ask the owner.

Proof

  • The dry run lists only untagged images and sha256-* tags older than 30 days. It lists no v*, latest or buildcache tag.
  • After the first real run, the tag counts of the four packages go down and then stay bounded.

Depends on: none

Proposed design

Problem statement

GHCR keeps every release of the service, runner and mcp-server packages. Each release adds a version tag and a sha256-* attestation tag. About 14 releases a day grow each package without bound. The only cleanup workflow covers the devcontainer package only. Its pr-* tag code has no target because no workflow pushes those tags. The owner decided on 2026-11-19 to keep the release tags and to delete untagged images and sha256-* tags older than 30 days.

Acceptance criteria

Requirement: Retention workflow replaces the devcontainer cleanup workflow

The repository SHALL hold the GHCR retention workflow at .github/workflows/ghcr-retention.yml with the name GHCR Retention, and SHALL hold no workflow file at .github/workflows/cleanup-devcontainer.yml.

Scenario: Merged default branch lists the retention workflow

  • WHEN uv run devops gh workflow list --all --json name,path runs on the merged default branch
  • THEN It lists GHCR Retention at .github/workflows/ghcr-retention.yml and no entry with the path .github/workflows/cleanup-devcontainer.yml.

Requirement: Four-package retention target

The cleanup step SHALL pass devops-cli/devcontainer, devops-cli/service, devops-cli/runner and devops-cli/mcp-server to the packages input of dataaxiom/ghcr-cleanup-action.

Scenario: Merged workflow names the four packages

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints packages: devops-cli/devcontainer,devops-cli/service,devops-cli/runner,devops-cli/mcp-server under the step that uses dataaxiom/ghcr-cleanup-action.

Requirement: Action stays pinned

The cleanup step MUST use dataaxiom/ghcr-cleanup-action at a 40-character commit SHA.

Scenario: Merged workflow pins the action

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints uses: dataaxiom/ghcr-cleanup-action@ with a 40-character commit SHA.

Requirement: Untagged and old attestation deletion

The cleanup step MUST set delete-untagged: true, delete-tags: sha256-*, older-than: 30 days, delete-orphaned-images: true and delete-ghost-images: true.

Scenario: Merged workflow names the deletion inputs

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints those five inputs with those values under the cleanup step.

Requirement: Release and cache tag exclusions

The cleanup step MUST set exclude-tags: latest,buildcache,v* so that no run deletes a release tag or a build cache tag.

Scenario: Merged workflow names the exclusions

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints exclude-tags: latest,buildcache,v*.

Requirement: PR tag code and its inputs removed

The workflow MUST have no pr-* tag resolution, no gh pr list query, no pull-requests: read permission, and no pr_number or tag dispatch input.

Scenario: Merged workflow has no PR cleanup

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints no pr-* pattern, no gh pr list command, no pull-requests: read and no pr_number or tag input.

Requirement: Daily schedule and dry run kept

The workflow MUST keep the 0 4 * * * schedule and the boolean dry_run dispatch input with the default false.

Scenario: Merged workflow keeps the schedule and the input

  • WHEN uv run devops gh workflow view ghcr-retention.yml --yaml runs on the merged default branch
  • THEN It prints the 0 4 * * * cron and a dry_run input of type boolean with default false.

Requirement: Workflow linters pass

The new workflow MUST pass actionlint and zizmor with the reduced permission set.

Scenario: The workflow linters pass on the PR

  • WHEN uv run devops ci --check --only actionlint,zizmor runs on the PR
  • THEN It exits 0 and prints no finding for .github/workflows/ghcr-retention.yml.

Requirement: Stale cleanup comment updated

The comment in .github/workflows/devcontainer-image.yml that names the 04:00 cleanup MUST name the retention workflow.

Scenario: The devcontainer image workflow names the retention workflow

  • WHEN uv run devops gh workflow view devcontainer-image.yml --yaml runs on the merged default branch
  • THEN It prints the 04:00 UTC cleanup comment with the name ghcr-retention.yml.

Requirement: Attestation store serves an old release

The PR MUST show that the GitHub attestation store returns the attestations of a v* release older than 30 days before the first real run deletes its sha256-* tag.

Scenario: The attestation of an old release is readable

  • WHEN uv run devops gh attestation verify oci://ghcr.io/dan-petty/devops-cli/service:<v-tag> --repo dan-petty/devops-cli runs for a v* tag older than 30 days of the service package
  • THEN It exits 0 and prints the verified attestation for the image digest.

Requirement: Pending a person after the merge

After the merge, a person SHALL run the retention workflow once with dry_run: true, confirm the list, and run it with dry_run: false; the tag counts of the four packages SHALL go down and stay bounded.

Scenario: A person runs the first dry run and the first real run

  • WHEN uv run devops gh workflow run ghcr-retention.yml -f dry_run=true and then uv run devops gh workflow run ghcr-retention.yml -f dry_run=false run, and the runs end
  • THEN The dry run log lists no v*, latest or buildcache tag, and the tag counts of the four packages go down and stay bounded.

Existing Tool Considered

No alternatives check has run on this issue. The open, maintained dataaxiom/ghcr-cleanup-action covers the retention. The workflow already pins it at .github/workflows/cleanup-devcontainer.yml:92. Its packages, delete-untagged, delete-tags, older-than, exclude-tags, dry-run, delete-ghost-images and delete-orphaned-images inputs cover each deletion rule, so the plan writes no own code. The action lacks a rule that keeps a sha256-* tag because a v* tag shares its digest. It does not read the GitHub attestation store. The PR's attestation check covers that gap.

Key questions

  • Which retention policy does the workflow apply?: Keep every v*, latest and buildcache tag. Delete untagged images and sha256-* tags older than 30 days. The owner decision of 2026-11-19 in the issue sets this policy. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:70, .github/workflows/cleanup-devcontainer.yml:97-100]
    • Chosen: Keep the release tags and delete untagged and old sha256-* versions after 30 days. The owner decision sets it, and the current step already deletes untagged versions.
    • Rejected: Delete every version older than 30 days. It deletes the release tags and the release history.
    • Rejected: Keep every version. Each package grows by about 14 versions a day.
  • Which tool does the retention?: Use dataaxiom/ghcr-cleanup-action, pinned at .github/workflows/cleanup-devcontainer.yml:92. Its packages, delete-untagged, delete-tags, older-than, exclude-tags, dry-run, delete-ghost-images and delete-orphaned-images inputs cover the change. The plan writes no own code. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:92, .github/workflows/cleanup-devcontainer.yml:93-104]
    • Chosen: Extend the pinned dataaxiom/ghcr-cleanup-action. The workflow already pins it, and its inputs cover each part of the change.
    • Rejected: Write a devops gh api pruner of our own. It adds code to build, keep and test for deletion that the action already does.
    • Rejected: Delete the cleanup workflow. It leaves the four packages with no retention.
  • Does the workflow keep the daily schedule and the dry_run input?: Yes. The 0 4 * * * cron and the boolean dry_run input with default false stay. A run with dry_run: true lists the versions before a real run deletes them. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:5-7, .github/workflows/cleanup-devcontainer.yml:19-23]
    • Chosen: Keep the schedule and dry_run. A daily run bounds each package, and a dry run lets a person check the list first.
    • Rejected: Dispatch only. No run deletes old versions on a schedule.
    • Rejected: Remove dry_run. A person cannot check the list before a real run.
  • Which tag patterns does exclude-tags hold?: Use latest,buildcache,v*. No package holds a main tag. The main entry of the current exclusion list protects nothing. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:70, .github/workflows/devcontainer-image.yml]
    • Chosen: latest,buildcache,v*. It protects the release tags and the build cache tag, the two kinds that must stay.
    • Rejected: Keep main in the list too. No package holds a main tag, so the entry protects nothing.
    • Rejected: v* only. It deletes the latest and buildcache tags.
  • Which code leaves the workflow?: Remove the pr-* tag resolution, the gh pr list query, the pull-requests: read permission and the pr_number and tag dispatch inputs. The file header says that no workflow pushes a pr-<n> tag since perf(ci): cancel superseded CodeQL runs and idle triggers #4651. The code has no target and the permission has no reader. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:3, .github/workflows/cleanup-devcontainer.yml:10-18, .github/workflows/cleanup-devcontainer.yml:37, .github/workflows/cleanup-devcontainer.yml:40-89]
    • Chosen: Remove the code and its inputs. No workflow pushes a pr-* tag, so the code has no target and the permission has no reader.
    • Rejected: Keep the code and add a pr-* tag. It adds a tag that no workflow writes.
    • Rejected: Move the code to a second workflow. It keeps dead code and adds a workflow.
  • Does the PR rename the file, the name and the concurrency group?: Yes. The file becomes .github/workflows/ghcr-retention.yml, the name becomes GHCR Retention and the concurrency group becomes ghcr-retention-${{ github.repository }}. The workflow covers four packages now. The PR also updates the comment at .github/workflows/devcontainer-image.yml that names the 04:00 cleanup. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:1, .github/workflows/cleanup-devcontainer.yml:26, .github/workflows/devcontainer-image.yml]
    • Chosen: Rename the file, the name and the concurrency group. The workflow covers four packages now, and the old names name one package and a tag that no workflow pushes.
    • Rejected: Keep the file name and change the name. A file named for one package holds a four-package workflow.
    • Rejected: Keep both names. The name stays wrong, and a reader cannot find the retention workflow.
  • Does the GitHub attestation store keep an attestation after its sha256-* registry tag is deleted?: Yes. The release workflow attests each image to the GitHub attestation store. The store keys the record by subject digest. The sha256-* tag is a registry tag, so the deletion removes the registry copy only. [sources: .github/workflows/release.yml]
  • What does the PR do when the attestation check finds no record?: Add sha256-* to exclude-tags, keep the untagged deletion, and comment on the issue for the owner. The registry copies of the attestations stay until the owner decides. (best practice) [sources: .github/workflows/cleanup-devcontainer.yml:70, .github/workflows/cleanup-devcontainer.yml:97-100]
    • Chosen: Keep sha256-* tags and ask the owner. It keeps the registry copies of the attestations until the owner decides.
    • Rejected: Delete the sha256-* tags anyway. It removes the registry copies of attestations that the store check did not confirm.
    • Rejected: Stop the PR. The untagged deletion still bounds the packages.
  • Which test or document names the removed pull-requests: read permission?: The zizmor check validates the workflow permission set. The live reference to the old workflow is the comment at .github/workflows/devcontainer-image.yml. The PR updates that comment. (best practice) [sources: .github/workflows/devcontainer-image.yml, .github/workflows/cleanup-devcontainer.yml:34-37]
    • Chosen: Use the actionlint and zizmor checks and update the devcontainer comment. The checks validate the workflow, and the comment is the live reference to the old workflow.
    • Rejected: Add a test that reads the workflow file. A test asserts no value of a manifest or a config file.
    • Rejected: Change no document. The comment would name a workflow that no longer exists.
  • Does Renovate keep the pinned action current?: Yes. The action stays a 40-character SHA pin. The github-actions manager of the Renovate preset updates it. The release-concurrency-and-renovate spec pins the digest of each github-actions dependency. [sources: openspec/specs/release-concurrency-and-renovate/spec.md, .github/workflows/cleanup-devcontainer.yml:92]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/infra
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  2. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/infra. The ci prefix of the title gives the type.
    • Scope: none. The title has the scope cleanup, and .github/labels.yml declares no scope/cleanup label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. The workflow holds packages: write, but a person must audit tags before the removal.
    • Value: Medium. The removal reduces write permissions and workflow clutter, but it affects only tag cleanup.
    • Effort: Medium. A person must audit GHCR tags and record the deletion decision before the change.
    • Related: feat(devcontainer): automate PR devcontainer cleanup on PR merge in GHCR #39, which asks for a different change. Both items concern the devcontainer tag cleanup workflow, but #39 adds the workflow and the candidate removes it after an audit.
  3. changed the title [-]ci(cleanup): remove the devcontainer tag cleanup workflow after a tag audit[/-] [+]ci(cleanup): Remove the devcontainer tag cleanup workflow[/+] on Nov 11, 2026
  4. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    The job shortened the title of this item. The summary had 62 characters, and the limit is 60. The type and the scope stay.

    • Before: ci(cleanup): remove the devcontainer tag cleanup workflow after a tag audit
    • After: ci(cleanup): Remove the devcontainer tag cleanup workflow
    • Source of the summary: the background model
  5. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: Do any pr-* tags remain in devops-cli/devcontainer in GHCR? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  6. changed the title [-]ci(cleanup): Remove the devcontainer tag cleanup workflow[/-] [+]ci(cleanup): prune untagged GHCR images and old attestation tags[/+] on Nov 19, 2026
  7. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agentstatus/newtype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions