ci: the gates job checks out in plain shell, so it runs instead of dying at step 0 #5

Open
juno wants to merge 3 commits from juno/4-gates-plain-shell-checkout into main
Member

Refs #4 — the gates job runs the suite on the forge instead of dying in 2 s during job setup.

What was wrong

gates (OTP 28.4.3 / Elixir 1.18.4) runs in container: ghcr.io/macula-io/macula-ci-pq:ex118-20261005-1119@sha256:f8b10b0c… — an image with git and the Elixir toolchain, and no node. Its first step was actions/checkout@v4, a JavaScript action, so on the forge the job died at exitcode 127 before any step of its own: macula-io/martha#601, the defect the advisories job in this repository already carries the fix for. The image is not at fault: it pulls, and the runner's daemon already holds it.

What changes

  • The checkout is the plain-shell step every repository on the forge uses, byte-identical to the copy in ci-images-dependency-advisories.yml (ci-images d42d37e6): same token handling, same refusal if the commit checked out is not github.sha.
  • The job's three other marketplace actions are asked for only on github.com — the two actions/cache steps and the tested-mix-lock upload. They are JavaScript actions too, so on the forge each would have failed the same way. The upload feeds the image job, which is github.com-only already (it pushes to ghcr and is signed by an OIDC token), so the forge loses nothing but the cache: it builds cold, in minutes.
  • The job runs as uid 1000 on the forge (container.options), not as the image's root: a root checkout lands root-owned in a self-hosted runner's persistent workspace, and the next job there then fails at its own checkout with EACCES, far from the cause. On github.com the workspace belongs to the job alone, so that path keeps the default user, as before.

Proof

The forge run of gates on this branch is the proof: the same image, no marketplace action left in the job, running format, compile --warnings-as-errors, credo, test and dialyzer.

Before pushing, the same steps were run by hand in that image, as uid 1000 with the job's own container.options, so neither the missing node nor the non-root user was left for CI to discover: deps, format, compile, credo, test and dialyzer all rc=0 (the log is in the handoff).

Refs #4 — the `gates` job runs the suite on the forge instead of dying in 2 s during job setup. ## What was wrong `gates (OTP 28.4.3 / Elixir 1.18.4)` runs in `container: ghcr.io/macula-io/macula-ci-pq:ex118-20261005-1119@sha256:f8b10b0c…` — an image with git and the Elixir toolchain, and no node. Its first step was `actions/checkout@v4`, a JavaScript action, so on the forge the job died at exitcode 127 before any step of its own: macula-io/martha#601, the defect the advisories job in this repository already carries the fix for. The image is not at fault: it pulls, and the runner's daemon already holds it. ## What changes - **The checkout is the plain-shell step** every repository on the forge uses, byte-identical to the copy in `ci-images-dependency-advisories.yml` (ci-images d42d37e6): same token handling, same refusal if the commit checked out is not `github.sha`. - **The job's three other marketplace actions are asked for only on github.com** — the two `actions/cache` steps and the `tested-mix-lock` upload. They are JavaScript actions too, so on the forge each would have failed the same way. The upload feeds the `image` job, which is github.com-only already (it pushes to ghcr and is signed by an OIDC token), so the forge loses nothing but the cache: it builds cold, in minutes. - **The job runs as uid 1000 on the forge** (`container.options`), not as the image's root: a root checkout lands root-owned in a self-hosted runner's persistent workspace, and the next job there then fails at its own checkout with EACCES, far from the cause. On github.com the workspace belongs to the job alone, so that path keeps the default user, as before. ## Proof The forge run of `gates` on this branch is the proof: the same image, no marketplace action left in the job, running format, `compile --warnings-as-errors`, credo, test and dialyzer. Before pushing, the same steps were run by hand in that image, as uid 1000 with the job's own `container.options`, so neither the missing node nor the non-root user was left for CI to discover: deps, format, compile, credo, test and dialyzer all rc=0 (the log is in the handoff).
ci: the gates job checks out in plain shell, and asks for marketplace actions only on github.com
Some checks failed
ci / image (amd64) (pull_request) Has been cancelled
ci / attest (pull_request) Has been cancelled
ci / guard-1 (pull_request) Has been skipped
c4 model / c4-model-1 (pull_request) Successful in 7s
c4 model / c4-model (pull_request) Successful in 0s
ci / guard (pull_request) Successful in 0s
ci / elixir in . (pull_request) Has been skipped
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Failing after 9s
ci / elixir in . (container) (pull_request) Successful in 8s
ci / Dependency advisories (pull_request) Successful in 0s
6899475d77
The gates job runs in a macula-ci image, which carries no node, and its first
step was `actions/checkout@v4` -- a JavaScript action. On the forge the job
died at exitcode 127 within 2-4 s, before any step of its own: the
macula-io/martha#601 defect, which this repository's advisories job already
carries the fix for.

The checkout is now the byte-identical plain-shell step the rest of the
organisation uses, and the job's three other marketplace actions -- two
`actions/cache` and the `tested-mix-lock` upload -- are asked for only on
github.com, where they run. On the forge the job builds cold, which is minutes
of PLT and deps, not a failure; the `image` job that consumes the artifact is
github.com-only already.

The job also runs as uid 1000 on the forge instead of the image's default user,
root: a root checkout lands root-owned in a self-hosted runner's persistent
workspace, and the next job on that runner then fails at its own checkout with
EACCES, far from the cause (the same reason the advisories call passes
`--user 1000:1000`). A GitHub-hosted runner's workspace belongs to its job
alone, so that path keeps the default user, as it ran before this change.

Refs #4
ci: the gates job gets a writable HOME on the forge
Some checks failed
c4 model / c4-model (pull_request) Has been cancelled
c4 model / c4-model-1 (pull_request) Has been cancelled
ci / guard (pull_request) Has been cancelled
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Has been cancelled
ci / Dependency advisories (pull_request) Has been cancelled
ci / image (amd64) (pull_request) Has been cancelled
ci / attest (pull_request) Has been cancelled
ci / guard-1 (pull_request) Has been cancelled
ci / elixir in . (pull_request) Has been cancelled
ci / elixir in . (container) (pull_request) Has been cancelled
a7340073e0
The first forge run of this job with the plain-shell checkout reached the
toolchain and then died in mix, before any gate: `could not make directory
(with -p) "/.mix/archives/hex-2.7.0"`. The image's `rl` user is uid 1000 with
home `/`, which it cannot write, so mix cannot install Hex there, and nothing
after it can run.

The forge container now runs with `--env HOME=/tmp` beside `--user 1000:1000`:
/tmp is the one writable path a job container is guaranteed, and mix, Hex and
rebar3 all keep their caches under HOME. A GitHub-hosted runner's home is
writable already and its container keeps the image's default user, so that path
is unchanged.

Refs #4
ci: why uid 1000 has no home, and the measurement behind it
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Failing after 4s
ci / guard-1 (pull_request) Has been skipped
ci / guard (pull_request) Successful in 0s
ci / elixir in . (pull_request) Has been skipped
ci / elixir in . (container) (pull_request) Successful in 7s
ci / Dependency advisories (pull_request) Successful in 0s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Failing after 0s
96f95d875c
The comment added with the HOME fix said the image's `rl` user was uid 1000
with home `/`. The image names no uid 1000 at all: a container started with
`--user 1000:1000` has no passwd entry to read a home from, so docker gives it
`/`, and that uid cannot write it. The defect and the fix are the same; the
reason is stated correctly now.

The same task (forge run 36, task 8432) is also what shows the `options`
conditional evaluates on this forge rather than blanking to nothing: its
`/.mix` failure is that uid's unwritable home, where a blank expression would
have left the job as root with a home it can write. A job cannot move its
container's options into a step, so `options` is the one place the platform is
named in an expression.

Comments only; no step changed.

Refs #4
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Failing after 4s
ci / guard-1 (pull_request) Has been skipped
ci / guard (pull_request) Successful in 0s
ci / elixir in . (pull_request) Has been skipped
ci / elixir in . (container) (pull_request) Successful in 7s
ci / Dependency advisories (pull_request) Successful in 0s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Failing after 0s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin juno/4-gates-plain-shell-checkout:juno/4-gates-plain-shell-checkout
git switch juno/4-gates-plain-shell-checkout
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
macula-services/mcl-kanban!5
No description provided.