logs.gokuls.in

1 pull request merged across 1 repo

bahdotsh/wrkflw

Why

After #171, three of the eight repositories in the sweep still failed locally on runs that pass on GitHub, for two reasons:

CauseRepos hit
Nothing outside the workspace survived between steps, because each step was a new containercobra (go install), ky's browser job (playwright install --with-deps), rust-lang/log (rustup toolchain add)
The runner image had no rustup or dockerrust-lang/log, cobra's licence job

What changes

One container per job is the default. It existed behind --job-container. It is now how a job's run: steps run on Docker and Podman.

  • --step-containers or WRKFLW_STEP_CONTAINERS=1 gives each step its own container again; --preserve-containers-on-failure still implies that.
  • --job-container is still accepted and does nothing.
  • The jobs of a called workflow share a container too, so their services now start.

The job container's memory is measured. It wasn't sampled before, so such a job was treated as never measured and a matrix ran one leg at a time on a small VM. The job's container and its services are now sampled through the CLI's stats, with the same out-of-memory and cancelled-step handling a step's own container has. Podman jobs stay unmeasured, as before.

Jobs that use the runner's Rust get it. A job whose run: steps call cargo, rustup, rustc or rustfmt without a Rust setup action gets rustup and stable in its image, as hosted runners have. An image mapped with -P, or a rust image, keeps its own, and a base that has rustup keeps its default toolchain.

Which steps run docker or cargo is read as a shell splits the script: multi-line quotes and heredocs stay whole, bash -c '...' and a heredoc a shell reads are looked into, and command -v docker doesn't count.

Stored results are keyed on the container mode (key version 4), so a pass with a container per step isn't reused under the new default.

--docker-in-jobs (opt-in). With it, or WRKFLW_DOCKER_IN_JOBS=1, a job whose steps run docker gets a Docker engine of its own inside its container.

  • That container runs privileged, which is why it is off by default.
  • The machine's engine is never handed to a step: -v $(pwd):/wrk would then name a path on the machine, not in the job, and a check could pass on an empty directory.
  • Without the flag, the run warns once that those steps will fail and names the flag.
  • Docker only: on Podman the run says those steps will fail.

Breaking

  • A workflow that only passed locally because each step started from a clean image now behaves as on GitHub.
  • A job that calls cargo with no setup action builds an image on its first run.
  • Library: Acceleration::job_container is replaced by step_containers (its opposite), and docker_in_jobs is new.
  • --reuse-results reruns every job once, as the result key's version changed.

All of this is in BREAKING_CHANGES.md.

Testing

  • cargo test --workspace: all pass, including three Docker-backed tests in container_fidelity_test (one new: what a step installs is there for the next, and isn't with --step-containers).
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check are clean.
  • Real runs on Docker Desktop (7.7 GB VM), with workflows written for this:
  • a step finds the apt-get package and the $HOME/bin tool the previous step installed; with --step-containers it fails as before
  • rustup toolchain add beta and rustup target add are there for the cargo step after them
  • docker run -v $(pwd):/wrk reads the workspace with --docker-in-jobs, and no container or volume is left behind
  • a three-leg matrix is measured on its first run

Benchmark

pallets/click at 1077444 against GitHub run 42384079679, release build, Docker Desktop (7.7 GB VM), images already built:

ModeRuns (s)Agree
One container per job (new default)121 (first, result key changed), 71, 72, 5511/11 every run
WRKFLW_STEP_CONTAINERS=167, 6211/11

Both modes take about the same time, so the new default doesn't slow click down. Both are slower than the 36–38 s measured on 2026-11-12, and --step-containers is just as slow, so the default isn't the cause. The cause isn't known yet.

Review fixes (87e9199)

  • The runner's Rust and the setup action's Rust use one rustup script. It downloads the installer to a file and checks rustup --version before linking, so a failed download fails the image build. Before this, the piped installer exited 0 with no rustup, and that Rust-less image was kept and reused. Checked in containers: offline it now fails (exit 127 without curl, 6 with it); online it installs cargo 1.100; an image with rustup is left as it is.
  • An image mapped with -P gets no Docker engine, just as it gets no Rust. Under --docker-in-jobs the run says that image must bring its own engine.
  • A case pattern is no longer read as a command, and << inside $((...)) is no longer read as a heredoc.
  • Memory samples can no longer land after the session has taken its containers off the meter.

Not verified

  • The eight-repo sweep has not been rerun with this branch, so the agreement count on those repos is still unknown.
  • Podman was not run; --docker-in-jobs is now refused there rather than tried.
  • Real runs after the review fixes (Docker Desktop): a -P image gets no Rust layer (cargo: command not found, as in the image), the default image has it; command -v docker raises no warning; bash -c 'docker run -v $(pwd):/wrk ...' warns without the flag and passes with it, leaving no container; a shared-container pass is not reused under --step-containers.