logs.gokuls.in

1 pull request merged across 1 repo

bahdotsh/wrkflw

Problem

Running real repositories was slow and sometimes wrong:

  • Each leg of a matrix rebuilt the same packages in its own image.
  • An image that failed to build was built a second time at the job's turn.
  • A busy engine failed container creation at 15 seconds.
  • A few parsing rules disagreed with GitHub.

Changes

Image builds

  • The job image is split into a shared packages layer plus one layer per runtime. The shared layers are built once, as an image of their own, where the runtime reuses build layers (Docker, Podman; not Kubernetes).
  • Images are built ahead while a job waits for its turn, capped at four across the process, and one at a time where the run limits its jobs.
  • BuildKit is used through the docker CLI where it builds into the same engine; otherwise the engine's own builder is used. WRKFLW_IMAGE_BUILDER=classic skips BuildKit.
  • A build that failed on its own is remembered for the run and not repeated. A build that timed out or lost its connection is tried again.
  • The runner's Node.js comes from nodejs.org, checked against its published checksum, with the distribution's package as the fallback.
  • Each runtime's install refreshes the package lists first, since it is now a layer of its own.

Containers

  • The engine gets 120 seconds to create or start a container. One whose creation timed out is tracked by name and removed later.
  • Cleanup passes quietly over a container that was never created, and removes by force one that didn't stop in time.
  • A step that only prints a line starts no container.

Agreement with GitHub

  • Matrix keys may contain hyphens (matrix.python-version).
  • schedule accepts its list of cron entries.
  • A push run no longer takes a base branch from the pull requests it lists.

Refactor

  • Image building and BuildKit move out of engine.rs into image_build.rs and buildkit.rs.

Testing

cargo build --workspace --all-targets, cargo clippy --workspace --all-targets (no warnings) and cargo test --workspace (all suites pass) were run locally on the final commit.

Known follow-ups

  • Run the downloaded Node before copying it under /usr/local, so a base with an old glibc falls back to the distribution's package.
  • Log a failed BuildKit probe and don't cache it for the process; document WRKFLW_IMAGE_BUILDER.
  • Add tests for the BuildKit dispatch in DockerRuntime::build_image_inner.
  • wrkflw-combined:shared-* images are never pruned.
  • ContainerError::ImageBuildTimeout is a new variant on a public enum.