Commit Graph
2 Commits
Author SHA1 Message Date
Marius Ciepluch 7ecd60ec4e ci(release): the retention prunes image versions too
The maintainer's request, on 2026-11-29: "packages haven't beeen updated in github. do we delete
them?". The two image packages were updated (2.2.0-alpha.1, three hours before); what is old is
the tag latest, which release.yml gives only to a release tag without a hyphen. Asked by menu
what to do with the image versions, the maintainer chose "Prune image versions (Recommended)":
keep the versions of the kept release tags, keep main with its sha tags, delete the other
sha-tagged and the untagged versions of openultrasast and openultrasast-runner; the first run
only lists, and the deletion waits for the maintainer's word.

What changed
.github/workflows/release-retention.yml, 150 to 262 lines (the python of the step: 105 to 215).
The rule for tags and releases is as before. For image versions, after the versions that go with
a deleted release tag: a version that carries no tag of a kept release and not main is pruned
when it is untagged or tagged with a sha only. Two safeguards, found while the rule was written
and in its review. First, an untagged version can be the image manifest or the attestation
manifest of an image that stays: the four release images read on 2026-11-29 are OCI indexes with
an amd64 manifest and an attestation manifest (s10_pkg_indexes.out), and the packages hold more
untagged versions than tagged ones. So the step logs in to the registry, reads the index of each
image that stays once, whatever tag keeps it, with docker buildx imagetools inspect, and keeps
every version whose digest is one of the manifests that index lists. The index is read one level
deep: an index inside it is not followed, and build-push-action makes none. Second, that fails
closed: an index none of whose manifests is a version of the package, an index entry without a
digest, or output that is not an index stops the job before anything is pruned or deleted. A
version with a tag the rule does not name, or untagged without a digest, stays and is listed.
The limit for image versions is 100 in one run (the limit of 20 stays for tags and releases).
The summary lists every version to prune with the start of its digest and its tags before
anything is deleted. A failed docker call stops the job and names the call and the reason, as a
failed gh call does.

Checks
The harness /tmp/opencode/s10_rr2_harness.py runs the python of the step on fixtures with
stand-ins for git, gh and docker (/tmp/opencode/s10_rr2_bin), ten cases. Against the workflow at
HEAD (d98334a) eight of the ten fail (s10_rr2_red.out): the old script prunes nothing, makes no
docker call, and has no limit for image versions. Against this file ten of ten pass
(s10_rr2_green.out): a dry run that lists and deletes nothing; two deleting runs that delete
exactly the expected 10 image versions and 5 tag operations (keep 3), and 13 and 6 (keep 1,
where the image of a pre-release goes with its release); a failing login, a failing index read,
an index entry without a digest, versions named by another form of digest, the image limit, a
failing read of the releases and a failing read of an image each stop the job with nothing
deleted. The harness also checks that the plan is complete in the summary at the first deleting
call, that each index is read once, and that the token is printed nowhere. The YAML parses, the
step passes bash -n and the python compiles; the file is ASCII, its widest line 120 columns; git
diff --check exits 0 (s10_rr2_diffcheck.out). The gates give ten zeros (s10_rr2_exits.txt, label
rr2). No test reads the workflow. The s10 files are under /tmp/opencode, outside the repository.

Not verified
The run on GitHub: whether the package versions API names each version by the digest that the
index lists, and what docker buildx imagetools inspect prints there. The first run is a dry run.
If the API names versions by another form of digest, that run stops on the second safeguard, and
nothing is deleted; its summary is read before any deletion.

Review.
Three read-only rounds, the harness re-run in each (last r3_new 10 of 10,
r3_head 2 of 10) and copies of the fixtures under /tmp/opencode/s10_rev_rr2.
Round one blocked the file on two gaps: an image that stays under another
tag lost its untagged children, and a digest of another form made the
safeguard match nothing. Round two found both closed, the tags and releases
part identical to d98334a, and blocked the message on one sentence, since
corrected. Round three found the file unchanged (same hash, same python),
the new fixture right by hand, and the mutant without the empty-digest guard
caught. Shown by runs: the dry run list and the deleting plan are equal;
every failed or malformed read stops the job with nothing deleted; twelve
mutants are caught. Open remarks: the stop needs no child to be a version;
a nested index is not followed. Not seen: the API's fields, the run, the chat.
2026-11-29 13:20:41 +01:00
Marius Ciepluch d68280bf2d ci(release): keep the three newest releases, tags and versioned images
The maintainer's request, in their words: "add a retention of 3 releases and
tags, and delete the old". The menu of 2026-11-28, four answers, each the option
recommended: the three newest version tags with their releases, by the date of
the tag, pre-releases included (the archive/* tags stay); one workflow that runs
after each release and on demand and logs what it deletes; the old ones are
listed first and deleted on the maintainer's word; older version tags of the
images are deleted too.

What changed
- One new file, .github/workflows/release-retention.yml (150 lines).
- Triggers: a manual run, with dry run on by default, and the end of the Tagged
  Release workflow. The run after a release only lists. A manual run with dry
  run off deletes.
- The rule: version tags (vX.Y.Z with an optional pre-release) by the date of
  the tag. The newest RELEASES_TO_KEEP (3) stay, and so does the latest stable
  release. The others go with their releases.
- Images: for openultrasast and openultrasast-runner, a version goes only when
  every one of its tags came from a deleted release tag (the version, and the
  major.minor of a stable one). A version that carries latest, main, a sha or
  a tag of a kept release stays and is named in the summary.
- Guards: a non-version tag is never touched; more than 20 deletions in one run
  stop the job; the plan is written to the job summary before the images are
  read and before anything is deleted; one read gives the releases and the
  latest stable release, and a failed read stops the job; a failed call fails
  the job, and the log names the call and the reason gh printed.

Checks
- s10_rr1_harness_evidence.out: the python of the workflow, taken out of the
  file and run on the local tags of this repository with a stand-in for gh.
  Five runs. A dry run that keeps 3 exits 0 and deletes nothing. A deleting
  run that keeps 3 makes nine deleting calls: five image versions, then four
  releases. A deleting run that keeps 1 leaves the latest stable release
  v2.0.1 in place and deletes the tag v2.0.0, which has no release, by the
  API: eleven calls. A deleting run where the read of the releases fails exits
  1 with no deleting call. A deleting run where the read of the first image
  fails exits 1 with the plan in its summary and no deleting call.
- s10_rr1_file.out: the file is ASCII; its longest line is 120 columns; the
  step passes bash -n and its python compiles.
- s10_rr1_exits.txt: the gates with label rr1, ten zeros (they do not read the
  workflow; they show that the tree is otherwise unchanged).

Not verified
- The run on GitHub itself. The path for user-owned packages with GITHUB_TOKEN
  (/user/packages/container/{name}/versions) is proven only by the first run.
  The documentation of GitHub says a workflow deletes package versions through
  the REST API only with admin permission on the package, which a repository
  that publishes the package has by default (public preview).
- No test in tests/ reads the new workflow.

Review.
Two rounds, read-only, on the workflow, release.yml, engine-image.yml, the harness,
its stand-in and the evidence; the step's own shell script ran under bash with my own
stand-ins for git and gh. Round one blocked the file: the read of the latest release
was swallowed, so with three pre-releases above the latest stable a failed read let a
deleting run exit 0, print nothing and delete the release and the tag v2.0.1; a failed
call named the command but not the reason. Round two: one read of the releases with
isLatest must succeed, gh() exits with the call, its code and the stderr, and the plan
precedes the images and the limit check. The attack repeated: exit 1, the call and its
502 named, no deleting call. Measured too: a failed delete names call and reason; a
failed image read leaves the plan in the summary; 27 planned deletions stop the same
way. The harness reproduces its five runs (exit 0, 0, 0, 1, 1; deleting calls 0, 9, 11,
0, 0); jq confirms the tab-separated rows. Left for GitHub: isLatest and the package path.
2026-11-28 20:25:43 +01:00