Repository navigation
Share apt-install and the release steps across repositories - #25
Conversation
Two repositories installed from apt in their own ways, and each had learned half of what a flaky Ubuntu mirror needs. One cached the downloaded packages and checked each restored file against the signed index, but made each apt call once, so a mirror answering 503 for a moment failed a package build before anything was built. The other retried an install five times, because the arm64 ports mirror can list a version its pool does not hold yet, and moved a service to a container after apt-get update hung a run for over twelve minutes. This action takes the cache and the index check, and bounds and retries each apt call. A timeout ends a hang, which nothing else bounds inside a composite action. apt's own Acquire::Retries covers a refused download. A failed install reads the package lists again before the next attempt, since a stale index is not fixed by downloading again. The whole is tried five times, 15 seconds apart, and a step that still fails says what it was doing and how the last attempt ended, naming a timeout as one. The retry logic is in retry.sh beside the action, sourced by its steps, so the tests drive the shipped code against stand-ins for apt-get, sudo, timeout and sleep under bash -eo pipefail, as GitHub runs the step. Signed-off-by: Gavin Lucas <Gavin@L337.org>
Claude review: changes requestedFindings1. Bug: calling the action twice in one job leaves the first call's cache entry permanently useless, with no warning ( The install step deletes every Take a job that installs build dependencies with one call and test dependencies with a later call:
On the next run, key1 is an exact hit ( The README does not tell callers to use the action only once per job. Possible fixes:
2. Bug: a multi-line
A YAML block scalar ( The raw Fix: split on any whitespace, for example 3. Maintainability: the most intricate step has no test, and no CI job runs the action ( The tests cover The test docstring says this cannot be tested because the step reads apt's own archive directory. Two ways around that:
Two places list what this repository's CI covers, and neither mentions apt-install now: README "Changing anything here" ("…and the action-pins check over sample references ( 4. Maintainability (recorded state): "each seen in this organisation's CI" and "(a 404 on arm64's ports mirror)" record what was observed on particular runs. The reasons for the timeout, the retries and the re-read stand without them. The commit message already records the incidents ("…moved a service to a container after apt-get update hung a run for over twelve minutes"), and that is where this kind of record belongs. Drop the history and keep the three failure modes as the rationale. What I checked
What I did not check
full review of |
…a runner Two calls in one job shared apt's archive directory, which the cache saves when the job ends. The later call deleted the earlier one's files as unused, so the earlier call's entry was saved holding the later call's files, and every run after restored files it deleted and downloaded again. Each call now downloads into a directory named for the packages it was asked for, through Dir::Cache::archives, and that directory is the one its cache entry holds. A package list written one to a line, as a YAML block scalar gives it, installed only its first line, and the raw newlines broke the step's output. The list is now split on any whitespace. The cache key is built from a hash of the sorted names, not the raw input, so a long list cannot reach the key's length limit. The install step's check of cached files against the index is now tested against a scratch directory and a stand-in apt-cache. A premerge job runs the action itself on a runner, twice in one job, and checks each call kept its own files, which no stand-in can show. retry.sh keeps the three ways a mirror fails as its reasons, and leaves the incidents to the history. Signed-off-by: Gavin Lucas <Gavin@L337.org>
|
All four points are fixed in 0464624.
Locally: the 112 tests pass, and actionlint and shellcheck are clean. The |
Claude review: approveResolved
Still open Declined New
What I checked
What I did not check
delta review of |
Each call's archive directory is its own, which an image's hooks that empty apt's default one never reach, so only APT::Keep-Downloaded-Packages can still leave it empty. The warning now names only that. The test file's imports lose a stray blank line. Signed-off-by: Gavin Lucas <Gavin@L337.org>
|
Both preferences are fixed in e494324. The warning now names only |
Claude review: approveResolved
Still open Declined New What I checked
What I did not check
delta review of |
…release Two repositories release a .deb from a published GitHub release, each with its own copy of the same three steps, which had drifted. Shared, a change to how a release is published - pushing to the package repository rather than leaving it to pull - is a change in one place. release-preflight checks the release is this organisation's and that its tag is the declared version. Versions are compared as text after a tag-prefix input, because one repository tags v1.2.3 and another tags 6.2; parsing them would have to know both forms. A major version of 0 is always a pre-release, so such a release must be marked one, read from the release when the step runs so that ticking the flag and re-running is enough. release-attach attaches the built files and reads each back from the release to compare with the build. A file of the same name already on the release is replaced rather than refused: preflight lets through only releases that should be built, so one there means an earlier run of this release failed after attaching it, and this run is recovering. An identical file is left as it is. release-cancelled turns a release job that ended as cancelled, as a timeout leaves it, into a failure, since a cancellation raises no notification and a release runs unattended. Signed-off-by: Gavin Lucas <Gavin@L337.org>
Claude review: approveResolved Still open Declined New
I found no stale recorded state in the new comments, README text or action descriptions. They state rules, and the tests hold the behaviour they describe. The premerge job runs What I checked
What I did not check
delta review of |
A name holding &, # or % went into the upload URL as it was, where GitHub would read it as more than one parameter, or a fragment. It is now percent-encoded. The fake release in the tests numbers its assets from a counter, so a delete followed by two uploads cannot reuse a live id, and words is declared before read fills it, so shellcheck reads it as assigned. Signed-off-by: Gavin Lucas <Gavin@L337.org>
|
All three preferences are fixed in 9238505.
Locally, all 133 tests pass and actionlint is clean. |
Claude review: approveResolved
Still open Declined New
I found no recorded state in the added comments or descriptions. What I checked
What I did not check
delta review of |
|
The comment is fixed in c32bd2e: it now names only |
The comment named a space among the characters encoding lets through, but a name cannot hold whitespace: files is split on it, and the asset listing is read by field, as the input's description says. Signed-off-by: Gavin Lucas <Gavin@L337.org>
Claude review: approveResolved
Still open Declined New What I checked What I did not check
delta review of |
A repository's tags only have to be consistent with its own history, so both v1.2.3 and a bare 6.2 are supported, and each repository says which it uses. New repositories use v, but the default stays none: a repository with bare tags would otherwise have to pass an explicit empty string, and GitHub documents a default only for an input that is not given, not for one given as empty. The one runner report on the point is for reusable workflows, open and unanswered. A test holds the default, so a later change to it is made knowingly. Signed-off-by: Gavin Lucas <Gavin@L337.org>
Claude review: approveResolved Still open Declined New
The new text states rules and their reasons, not recorded state. The remark that GitHub does not document how an explicit empty input interacts with a default is the reason for the design, not a measurement. The comment says "v is what new repositories use", which is a convention, not a count. What I checked What I did not check
delta review of |
release-preflight is to default tag-prefix to v, the form new repositories tag with, leaving a repository with bare tags to pass tag-prefix: ''. That works only if an input given as an empty string reaches the action empty, and GitHub documents a default only for an input that is not given. A probe action, called both ways from this repository's own CI, shows which it is, and keeps showing it, so a change in GitHub's behaviour fails here before a release relies on it. Signed-off-by: Gavin Lucas <Gavin@L337.org>
Claude review: changes requestedResolved Still open Declined New
What I checked
What I did not check
delta review of |
…de it The probe, run on GitHub's runner, shows an input not given takes its default and one given as an empty string arrives empty. So the default can be v, what new repositories tag with, and a repository with bare tags passes tag-prefix: '' without falling back to v. A test ties the default to the probe's job, so the one is not changed without the other. Signed-off-by: Gavin Lucas <Gavin@L337.org>
|
release-preflight's GitHub documents a default only for an input that isn't given, so whether
The job keeps running, so if GitHub's behaviour changed, this repository's CI would fail before any release relied on it. |
Claude review: approveResolved
Still open Declined New
What I checked
What I did not check
delta review of |
|
The changes-requested review of 100fdd3 is resolved by 918b6c4, as the next review confirms. 100fdd3 added the probe on its own, deliberately: the default changed to |
What
A shared
actions/apt-installcomposite action, for any job that installs from the runner image's apt sources. It combines what the two existing local implementations each got right:Downloads are cached and checked. The downloaded
.debfiles are cached under a key naming each package, version and architecture. Each restored file is checked against the SHA-256 the signed index lists before apt installs it. This part comes from quaffed's local action unchanged.Each apt call is bounded and retried, which neither repository did fully:
Acquire::Retries=3, for a download refused for a moment, such as a 503;A step that still fails says what it was doing and how the last attempt ended, and names a timeout as one.
Why
Debian package (amd64)job failed on a pull request because the mirror returned503 Service Unavailableonce, and its local action made one attempt.apt-get updatewith no bound hung one of its runs for over twelve minutes.Tested
tests/test_apt_install.pyruns the shippedretry.sh, and the action's step that reads the package lists, underbash -eo pipefail. It uses stand-ins forapt-get,sudo,timeoutandsleep. It covers:After merge
Callers reach it once a release moves
v2. It adds a new action and changes nothing existing, so a minor release,v2.1.0, fits. Then quaffed and send-to-influx each move to it in their own pull request:The installs inside send-to-influx's
debian:12container can't use an action, and are not covered.Added: the shared release steps
Three more shared pieces, for the steps quaffed's and send-to-influx's release workflows each wrote for themselves:
actions/release-preflightchecks that the release is this organisation's and that its tag is the declared version.tag-prefixinput that defaults tov, the form new repositories tag with. send-to-influx, which tags a bare6.2, passestag-prefix: ''. Theinput-defaultspremerge job shows on GitHub's runner that an input given as''arrives empty and does not fall back to the default, and keeps showing it.actions/release-attachattaches the built files, then reads each one back from the release and compares it with the build.files:takes whitespace-separated paths or globs..github/workflows/release-cancelled.yamlturns a cancelled release job into a failure, so a timeout doesn't end the release silently.Tested:
tests/test_release_actions.pyruns each step's shipped script, with stand-ins forghandcurlsharing a fake release on disk. It covers:Locally, all 132 tests pass and actionlint is clean. Not tested: GitHub's real upload, delete and download endpoints. Nothing here runs on a real release until a caller uses it.
After merge: quaffed's and send-to-influx's release workflows each move to these in their own pull request, along with the apt-install move.
Not tested before merge
release-attachhas not run against GitHub's real release API: the tests use a fake release. It first runs for real on the first quaffed or send-to-influx release after either moves to it. If that fails, the release run fails without attaching anything, and a re-run recovers, since a re-run may replace what an earlier one left. A CI job testing against a throwaway draft release was considered and not added.