ci(images): clean up stale development images #30

Merged
ryan.mcgee merged 6 commits from ci/clean-development-packages into main 2026-10-20 21:50:19 +00:00
Owner

Summary

  • Development images (<version>-dev.<commit>) were never removed, so merged and superseded branches left packages behind.
  • A version is now kept only while its commit is the head of a branch other than main. This needs no branch-to-commit mapping, so it also covers superseded pushes and force-pushes.

Changes

  • scripts/clean-development.sh: lists both packages, deletes stale -dev.<sha> versions, and deletes the untagged sha256: manifest versions the forge may leave behind, but only when no remaining tag refers to them (directly or as a child of an image index) and they are older than an hour. Releases, latest and development are never deleted. A failed manifest lookup aborts the run before anything is deleted.
  • .github/workflows/clean-development.yml: runs when a branch is deleted (merging deletes it), every Sunday as a safety net, and on demand (a manual run is a dry run by default). Uses REGISTRY_TOKEN for the packages and the job token to read the branch list.
  • README: describes the cleanup.

Verification

  • Mock forge (branches, package listing, registry manifests, deletes): a live branch's image, a release, latest, development, an image index and its child manifest, and a young orphan are kept; merged-branch images, an older-version dev image and unreferenced old manifests are deleted from both packages; development keeps working after its own dev tag is removed; a second run deletes nothing; a failed manifest lookup deletes nothing.
  • Real forge, through a temporary probe workflow on this branch (removed in the last commit; it reported as commit statuses): a dry run listed 12 stale versions, among them 1.0.0-dev.9421339; a real run then deleted 14 (the 12 plus two images of this branch's earlier probe commits, superseded by later pushes) with exit 0; a final dry run listed only the next superseded image; the remaining versions of both packages were 1.0.0, latest, development and the branch's current head.
  • shellcheck -x and actionlint clean.
  • Not run: the delete event trigger (it runs from the default branch once this is merged), and the weekly schedule.
## Summary - Development images (`<version>-dev.<commit>`) were never removed, so merged and superseded branches left packages behind. - A version is now kept only while its commit is the head of a branch other than `main`. This needs no branch-to-commit mapping, so it also covers superseded pushes and force-pushes. ## Changes - `scripts/clean-development.sh`: lists both packages, deletes stale `-dev.<sha>` versions, and deletes the untagged `sha256:` manifest versions the forge may leave behind, but only when no remaining tag refers to them (directly or as a child of an image index) and they are older than an hour. Releases, `latest` and `development` are never deleted. A failed manifest lookup aborts the run before anything is deleted. - `.github/workflows/clean-development.yml`: runs when a branch is deleted (merging deletes it), every Sunday as a safety net, and on demand (a manual run is a dry run by default). Uses `REGISTRY_TOKEN` for the packages and the job token to read the branch list. - README: describes the cleanup. ## Verification - Mock forge (branches, package listing, registry manifests, deletes): a live branch's image, a release, `latest`, `development`, an image index and its child manifest, and a young orphan are kept; merged-branch images, an older-version dev image and unreferenced old manifests are deleted from both packages; `development` keeps working after its own dev tag is removed; a second run deletes nothing; a failed manifest lookup deletes nothing. - Real forge, through a temporary probe workflow on this branch (removed in the last commit; it reported as commit statuses): a dry run listed 12 stale versions, among them `1.0.0-dev.9421339`; a real run then deleted 14 (the 12 plus two images of this branch's earlier probe commits, superseded by later pushes) with exit 0; a final dry run listed only the next superseded image; the remaining versions of both packages were `1.0.0`, `latest`, `development` and the branch's current head. - `shellcheck -x` and `actionlint` clean. - Not run: the `delete` event trigger (it runs from the default branch once this is merged), and the weekly schedule.
ci(images): clean up stale development images
Some checks failed
CI / tests (SQLite) (pull_request) Has been cancelled
CI / tests (PostgreSQL) (pull_request) Has been cancelled
CI / dependency audit (pull_request) Has been cancelled
Development images / images (push) Has been cancelled
CI / format, compile, credo, dialyzer (pull_request) Has been cancelled
35d2d555bd
- delete development versions whose commit is no longer the head of
  a branch, and the untagged manifest versions nothing refers to
- run when a branch is deleted, weekly, and on demand as a dry run
- never touch releases, latest or development
chore: temporary cleanup probe
Some checks failed
Development images / images (push) Successful in 11s
Cleanup probe / probe (push) Successful in 10s
CI / tests (PostgreSQL) (pull_request) Has been cancelled
CI / dependency audit (pull_request) Has been cancelled
CI / tests (SQLite) (pull_request) Has been cancelled
CI / format, compile, credo, dialyzer (pull_request) Has been cancelled
b644b40f3e

cleanup probe (DRY_RUN=1) exit 0

clean-development: branch heads kept: 1
clean-development: would delete traefik-control-sqlite3 1.0.0-dev.35d2d55
clean-development: would delete traefik-control-sqlite3 1.0.0-dev.784734a
clean-development: would delete traefik-control-sqlite3 1.0.0-dev.d648008
clean-development: would delete traefik-control-sqlite3 1.0.0-dev.9421339
clean-development: would delete traefik-control-sqlite3 1.0.0-dev.afe4b1d
clean-development: would delete traefik-control-sqlite3 0.1.0-dev.2e2b361
clean-development: would delete traefik-control-postgres 1.0.0-dev.784734a
clean-development: would delete traefik-control-postgres 1.0.0-dev.9421339
clean-development: would delete traefik-control-postgres 1.0.0-dev.afe4b1d
clean-development: would delete traefik-control-postgres 0.1.0-dev.2e2b361
clean-development: 10 version(s) would be deleted
cleanup probe (DRY_RUN=1) exit 0 ``` clean-development: branch heads kept: 1 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.35d2d55 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.784734a clean-development: would delete traefik-control-sqlite3 1.0.0-dev.d648008 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.9421339 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.afe4b1d clean-development: would delete traefik-control-sqlite3 0.1.0-dev.2e2b361 clean-development: would delete traefik-control-postgres 1.0.0-dev.784734a clean-development: would delete traefik-control-postgres 1.0.0-dev.9421339 clean-development: would delete traefik-control-postgres 1.0.0-dev.afe4b1d clean-development: would delete traefik-control-postgres 0.1.0-dev.2e2b361 clean-development: 10 version(s) would be deleted ```
chore: temporary cleanup probe reports as statuses
Some checks failed
probe/02 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.b644b40
probe/03 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.35d2d55
probe/04 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.784734a
probe/exit DRY_RUN=1 exit 0
probe/01 clean-development: branch heads kept: 1
probe/05 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.d648008
probe/08 clean-development: would delete traefik-control-sqlite3 0.1.0-dev.2e2b361
probe/13 clean-development: would delete traefik-control-postgres 0.1.0-dev.2e2b361
Cleanup probe / probe (push) Successful in 13s
probe/06 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.9421339
probe/07 clean-development: would delete traefik-control-sqlite3 1.0.0-dev.afe4b1d
probe/09 clean-development: would delete traefik-control-postgres 1.0.0-dev.b644b40
probe/10 clean-development: would delete traefik-control-postgres 1.0.0-dev.784734a
probe/11 clean-development: would delete traefik-control-postgres 1.0.0-dev.9421339
probe/12 clean-development: would delete traefik-control-postgres 1.0.0-dev.afe4b1d
probe/14 clean-development: 12 version(s) would be deleted
Development images / images (push) Successful in 13s
CI / tests (PostgreSQL) (pull_request) Has been cancelled
CI / dependency audit (pull_request) Has been cancelled
CI / tests (SQLite) (pull_request) Has been cancelled
CI / format, compile, credo, dialyzer (pull_request) Has been cancelled
5205ee65ff
chore: temporary cleanup probe, real run
Some checks failed
Development images / images (push) Successful in 11s
probe/exit DRY_RUN=0 exit 0
probe/01 clean-development: branch heads kept: 1
probe/02 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.5205ee6
probe/03 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.b644b40
probe/04 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.35d2d55
probe/05 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.784734a
probe/06 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.d648008
probe/07 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.9421339
probe/08 clean-development: deleting traefik-control-sqlite3 1.0.0-dev.afe4b1d
probe/09 clean-development: deleting traefik-control-sqlite3 0.1.0-dev.2e2b361
probe/10 clean-development: deleting traefik-control-postgres 1.0.0-dev.5205ee6
probe/11 clean-development: deleting traefik-control-postgres 1.0.0-dev.b644b40
probe/12 clean-development: deleting traefik-control-postgres 1.0.0-dev.784734a
probe/13 clean-development: deleting traefik-control-postgres 1.0.0-dev.9421339
probe/14 clean-development: deleting traefik-control-postgres 1.0.0-dev.afe4b1d
probe/15 clean-development: deleting traefik-control-postgres 0.1.0-dev.2e2b361
probe/16 clean-development: 14 version(s) deleted
Cleanup probe / probe (push) Successful in 17s
CI / tests (PostgreSQL) (pull_request) Has been cancelled
CI / dependency audit (pull_request) Has been cancelled
CI / tests (SQLite) (pull_request) Has been cancelled
CI / format, compile, credo, dialyzer (pull_request) Has been cancelled
d18f868acb
chore: temporary cleanup probe, verify
Some checks failed
probe/exit DRY_RUN=1 exit 0
probe/dry clean-development: 2 version(s) would be deleted
probe/remaining-sqlite3 1.0.0 1.0.0-dev.b148c49 1.0.0-dev.d18f868 development latest
probe/remaining-postgres 1.0.0 1.0.0-dev.b148c49 1.0.0-dev.d18f868 development latest
Development images / images (push) Successful in 12s
Cleanup probe / probe (push) Successful in 11s
CI / format, compile, credo, dialyzer (pull_request) Successful in 1m18s
CI / dependency audit (pull_request) Has been cancelled
CI / tests (SQLite) (pull_request) Has been cancelled
CI / tests (PostgreSQL) (pull_request) Has been cancelled
b148c49a74
chore: remove temporary cleanup probe
All checks were successful
Development images / images (push) Successful in 16s
CI / format, compile, credo, dialyzer (pull_request) Successful in 1m38s
CI / tests (SQLite) (pull_request) Successful in 2m18s
CI / dependency audit (pull_request) Successful in 43s
CI / tests (PostgreSQL) (pull_request) Successful in 2m8s
1d306f3ebc
ryan.mcgee deleted branch ci/clean-development-packages 2026-10-20 21:50:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
White_Ghost_Cyber_Systems/traefik-control!30
No description provided.