Repository navigation
ci: keep the Docker Hub listing in a fixed order - #822
LeeroyHannigan wants to merge 1 commit into
Conversation
Docker Hub lists a namespace's repositories by last push, newest first. It has no setting for the order, so each publish moves its image to the top of the list. ci/dockerhub-order.py keeps the order postgres, dev, cassandra, mongodb. It finds the lowest repository that is not newer than the one below it. Then, from the bottom up, it pushes the manifest that the latest tag already points to, byte for byte, for that repository and each one above it. No tag changes digest, so signatures and pinned pulls stay the same. The Docker Hub jobs of release-dev-image, release-image, sign-image and promote-image run it after their last Docker Hub push. The script reads the credential that those jobs already hold. The step has continue-on-error and the script runs with --warn-only, so a failure in it never fails a release.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at c7c282d. Ran ci/dockerhub-order.py offline against a stubbed Docker Hub (six plan cases, two concurrent-promotion trials) and merged the head with main at 7c8a776. The review covers how the re-push interacts with concurrent latest moves from other publish workflows.
1 finding is left inline.
| def push_again(repo, creds, expected): | ||
| token = registry_token(repo, creds) | ||
| content_type, body = fetch_manifest(repo, token, expected) | ||
| status, _, reply = request("PUT", manifest_url(repo), { |
There was a problem hiding this comment.
This PUT can move another image's latest back to its previous digest. The four publish workflows use separate concurrency groups (promote-image-<image>, release-image-<image>, release-image-extenddb-dev, sign-image-<image>), so a mongodb promotion's step can re-push postgres while a postgres promotion moves it. Against a stubbed registry, moving postgres latest between this script's GET and PUT left it on the old digest, and the step exited 0 printing "same digest". One concurrency group shared by every job that runs this step would close the gap.
navareamol
left a comment
There was a problem hiding this comment.
The script is fine in my checks. Four items, none about the concurrency point already raised.
-
The step can wait a long time and has no limit. wait_for_move waits up to 120 s per pushed repository, the final listing check up to 60 s, and each HTTP call up to 30 s. A full plan of three repositories is about 7 minutes inside a job that holds the Docker Hub credential and an approval. With a stub registry that does not move last_updated after a push, the step sat the full 120 s before it warned. Can you add timeout-minutes to the four steps (for example 10), so a slow Docker Hub cannot hold the job?
-
If a push fails part way, the listing can end in a different wrong order. With a stub registry, a plan of cassandra, dev, postgres where the third PUT returns 500 leaves postgres below cassandra and dev, and the step warns and exits 0. The old order was also wrong, so this is not a regression. I think a line in the warning that says which repositories were already pushed would help whoever reads it. Is that reasonable?
-
dockerhub-description.yml sends a PATCH to the same repositories. Does a description PATCH change last_updated on Docker Hub? If it does, that workflow reorders the listing and nothing restores it. I could not measure this without the credential. Have you checked?
-
The description says Cassandra has no latest tag until its first promotion. Today the Docker Hub API returns a digest for extenddb-cassandra latest, so the sentence is out of date. The branch is also 203 commits behind main. Can you rebase and update that line?
On the concurrency finding already posted: if you move to one shared concurrency group, please check what GitHub does with a third job that arrives while one is running and one is queued, since a newer queued job replaces the older queued one in the same group.
I will approve once the step has a time limit and the description is updated.
What
This PR adds
ci/dockerhub-order.pyand runs it at the end of each job that pushes to Docker Hub:release-dev-image.yml, jobpublishrelease-image.yml, jobpublish-candidatesign-image.yml, jobsignpromote-image.yml, jobpromoteThe script keeps the
extenddbrepositories on Docker Hub in this order: postgres, dev, cassandra, mongodb. It finds the lowest repository that is not newer than the one below it. Then, from the bottom up, it pushes the currentlatestmanifest again, byte for byte, for that repository and each one above it.The digest does not change, so the image, its signature and pinned pulls stay the same. Before a push, the script checks that the bytes hash to the digest that Docker Hub reports. After the push, it checks that
lateststill resolves to that digest.The new step has
continue-on-error: trueand runs the script with--warn-only. A failure in the step gives a warning, and the release continues. Without--apply, the script needs no credentials. It prints the plan and checks the manifests.Why
Docker Hub has no setting for the order of the repositories in a namespace. It lists them by last push, newest first. Each publish moves its image to the top. After the 2026-10-23 release, the listing was mongodb, postgres, dev.
The step runs inside the
dockerhubenvironment jobs, because only those jobs hold the Docker Hub credential. A separate workflow would need a second approval for each run. A scheduled job would need the credential outside the protected environment.Points for reviewers:
latestmanifest of other images again. For example, a mongodb promotion pushes thelatestmanifests of cassandra, dev and postgres. No digest changes, but Docker Hub shows a new "last pushed" time for those tags.latesttag. Cassandra has none until its first promotion. If a release publishes mongodb before then, the step warns and mongodb stays above cassandra.Testing done
latestdigests (devsha256:f7fa71e39d2c, postgressha256:9f54c9f4b7a4).--applyrun on 2026-11-04 used an earlier copy of this script with the same push logic. It pushed thelatesttag of dev at 14:03:51 UTC and of postgres at 14:03:57 UTC. The listing then showed postgres, dev, cassandra, mongodb, and bothlatesttags kept their digests.Already in order. Nothing to push.--warn-only, a missinglatesttag, a missing token and a network error each printed a::warningline and exited 0. Without--warn-only, the missing tag exited 1 and the network error raised an exception.actionlinton the four workflows, on this branch and with this commit applied to main at 7c8a776: no findings.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.