Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/publish-tool-images.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish tool images

# Builds the reference images in tool-images/ (the tool-cache and system-library capability images, see the ARC role README's Capabilities section, and the build runner image, the stock runner image with a C toolchain) for linux/amd64 and linux/arm64 and pushes them to this repository owner's GitHub Container Registry namespace, as ghcr.io/<owner>/github-runner-toolcache-<name>, ghcr.io/<owner>/github-runner-sysroot-<name> and ghcr.io/<owner>/github-runner-runner-<name>, each tagged with the version its Dockerfile pins (its ARG <TOOL>_VERSION default; for the build runner image, the runner version it extends). A version tag that already exists is left alone, so a published version never changes under anyone pinning it and a run publishes only the images whose pinned version is new. The job summary lists each pushed image by digest, the reference to pin in a capability or as a runner image. A build runner entry with a runner_id builds the same Dockerfile with RUNNER_UID and RUNNER_GID set to it and tags it <runner version>-uid<id>: the runner user at that id, for a fleet whose nodes give the stock id (1001) to an account of their own and reserve this one for the runner (tool-images/build/Dockerfile says why the id reaches the nodes). Each entry's digest artifacts are named with the architecture before the tag, so one tag's download pattern never matches another's artifacts.
# Builds the reference images in tool-images/ (the tool-cache and system-library capability images, see the ARC role README's Capabilities section, and the build runner image, the stock runner image with a C toolchain) for linux/amd64 and linux/arm64 and pushes them to this repository owner's GitHub Container Registry namespace, as ghcr.io/<owner>/github-runner-toolcache-<name>, ghcr.io/<owner>/github-runner-sysroot-<name> and ghcr.io/<owner>/github-runner-runner-<name>, each tagged with the version its Dockerfile pins (its ARG <TOOL>_VERSION default, followed by -r<IMAGE_REVISION> where it declares one, as scripts/ci/tool_image_tag.sh prints it; for the build runner image, the runner version it extends). A version tag that already exists is left alone, so a published version never changes under anyone pinning it and a run publishes only the images whose pinned version is new. The job summary lists each pushed image by digest, the reference to pin in a capability or as a runner image. A build runner entry with a runner_id builds the same Dockerfile with RUNNER_UID and RUNNER_GID set to it and tags it <runner version>-uid<id>: the runner user at that id, for a fleet whose nodes give the stock id (1001) to an account of their own and reserve this one for the runner (tool-images/build/Dockerfile says why the id reaches the nodes). Each entry's digest artifacts are named with the architecture before the tag, so one tag's download pattern never matches another's artifacts.
#
# Runs only when started by hand or by pushing a tag named tool-images-<anything>; the release workflow does not build these images. Each architecture is built natively, on GitHub's amd64 and arm64 hosted runners, and pushed by digest, and a second job joins the two into one multi-architecture tag (https://docs.docker.com/build/ci/github-actions/multi-platform/), because compiling the system libraries under emulation is far slower than natively.

Expand Down Expand Up @@ -34,6 +34,7 @@ jobs:
- {name: tflint, kind: toolcache}
- {name: awscli, kind: toolcache}
- {name: strace, kind: toolcache}
- {name: rust, kind: toolcache}
- {name: openmpi, kind: sysroot}
- {name: highs, kind: sysroot}
- {name: libpq, kind: sysroot}
Expand All @@ -56,11 +57,7 @@ jobs:
RUNNER_ID: ${{ matrix.image.runner_id }}
run: |
set -euo pipefail
version="$(sed -n 's/^ARG [A-Z_]*_VERSION=//p' "tool-images/${NAME}/Dockerfile")"
if [ -z "$version" ] || [ "$(wc -l <<<"$version")" != 1 ]; then
echo "tool-images/${NAME}/Dockerfile must pin exactly one ARG <TOOL>_VERSION" >&2
exit 1
fi
version="$(scripts/ci/tool_image_tag.sh "tool-images/${NAME}/Dockerfile")"
echo "repository=ghcr.io/${OWNER,,}/github-runner-${KIND}-${NAME}" >>"$GITHUB_OUTPUT"
echo "version=${version}${RUNNER_ID:+-uid${RUNNER_ID}}" >>"$GITHUB_OUTPUT"

Expand Down Expand Up @@ -136,6 +133,7 @@ jobs:
- {name: tflint, kind: toolcache}
- {name: awscli, kind: toolcache}
- {name: strace, kind: toolcache}
- {name: rust, kind: toolcache}
- {name: openmpi, kind: sysroot}
- {name: highs, kind: sysroot}
- {name: libpq, kind: sysroot}
Expand All @@ -155,7 +153,7 @@ jobs:
RUNNER_ID: ${{ matrix.image.runner_id }}
run: |
set -euo pipefail
version="$(sed -n 's/^ARG [A-Z_]*_VERSION=//p' "tool-images/${NAME}/Dockerfile")"
version="$(scripts/ci/tool_image_tag.sh "tool-images/${NAME}/Dockerfile")"
echo "repository=ghcr.io/${OWNER,,}/github-runner-${KIND}-${NAME}" >>"$GITHUB_OUTPUT"
echo "version=${version}${RUNNER_ID:+-uid${RUNNER_ID}}" >>"$GITHUB_OUTPUT"

Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/rust-toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Rust toolchain

# Builds the Rust tool image (tool-images/rust) natively on amd64 and arm64 and proves it works (tests/rust_toolchain/run.sh): its tool cache is filled as the role's init container fills it, the role's own job-started hook puts the toolchain on PATH inside the reference build runner image, and a small crate with a C source is formatted, linted, tested, checked by cargo-deny and cross-compiled for every target the image carries, each executable then checked for its target (an Apple one loading no framework). A pull request that changes what the image builds without changing the tag it is published under fails. Only on changes that can affect it. Builds nothing it publishes.

on:
pull_request:
paths:
- tool-images/rust/**
- tool-images/build/**
- tests/rust_toolchain/**
- tests/capabilities/render.yml
- roles/github_runner_arc/files/job-started.sh
- roles/github_runner_arc/tasks/render_scale_set_values.yml
- plugins/filter/arc.py
- scripts/ci/tool_image_tag.sh
- scripts/ci/check_tool_image_tag.sh
- .github/workflows/rust-toolchain.yml
workflow_dispatch:

concurrency:
group: rust-toolchain-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
tag:
name: Published tag follows the image
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 2

- name: Compare with the base branch's image
# The checkout is the pull request merged into its base, so the first parent is the base the change would land on.
run: |
set -euo pipefail
image=tool-images/rust
if [ -z "$(git ls-tree --name-only HEAD^1 -- "${image}/Dockerfile")" ]; then
echo "${image} is new: nothing is published under its tag yet"
exit 0
fi
mkdir -p "${RUNNER_TEMP}/base"
git archive HEAD^1 "$image" | tar -x -C "${RUNNER_TEMP}/base"
scripts/ci/check_tool_image_tag.sh "${RUNNER_TEMP}/base/${image}" "$image"

toolchain:
name: Every target builds (${{ matrix.platform.arch }})
runs-on: ${{ matrix.platform.runner }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
platform:
- {arch: amd64, runner: ubuntu-latest}
- {arch: arm64, runner: ubuntu-24.04-arm}
steps:
- uses: actions/checkout@v7

- name: Install Ansible
run: |
set -euo pipefail
if ! python3 -m venv "${RUNNER_TEMP}/venv" 2>/dev/null; then
sudo apt-get update -qq
sudo apt-get install -y -qq python3-venv
python3 -m venv "${RUNNER_TEMP}/venv"
fi
"${RUNNER_TEMP}/venv/bin/pip" install --quiet --prefer-binary ansible-core pyyaml
echo "${RUNNER_TEMP}/venv/bin" >> "$GITHUB_PATH"

- name: Run the toolchain test
run: tests/rust_toolchain/run.sh
1 change: 1 addition & 0 deletions docs/build-and-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
```
- **Confirm no disk accumulates across repeated runner jobs:** the Docker host's disk usage (inside the VM, on a host that runs Docker in one) must stay flat across repeated `test-arc-runner.yml` runs.
- **Test capabilities:** `tests/capabilities/run.sh` builds the reference Node.js tool image and libpq system-library image, renders a profile with capabilities through the ARC role and the scale-set chart, and runs a pod from the chart's runner template in a throwaway kind cluster to check that the tool reaches the tool cache and `PATH` and the library reaches the sysroot and its search paths; `.github/workflows/capabilities.yml` runs it on pull requests. `tests/system_libraries/run.sh [openmpi|highs|libpq|glpk|libmariadb]...` proves each reference system-library image works relocated: it copies the payload to `/opt/sysroot` as the role's init container does, applies the role's job-started hook, and runs the payload's programs in the stock `actions-runner` image and a program compiled against it in the reference build runner image (`tool-images/build`, the stock image with `build-essential` and `pkg-config`), including a two-process `mpirun` for Open MPI; `.github/workflows/system-libraries.yml` runs it on amd64 and arm64 on pull requests. The images under `tool-images/` build with `docker buildx build --platform linux/arm64,linux/amd64 tool-images/<name>`; `.github/workflows/publish-tool-images.yml` publishes them (see Releases), and the release workflow does not.
- **Test the Rust tool image:** `tests/rust_toolchain/run.sh` builds `tool-images/rust` and cross-compiles a small crate for every target it carries in the reference build runner image (see [The Rust tool image](../roles/github_runner_arc/README.md#the-rust-tool-image)); `.github/workflows/rust-toolchain.yml` runs it on amd64 and arm64 on pull requests.
- **Test the build runner image's ids:** `tests/runner_build/run.sh` builds `tool-images/build` with its default runner ids and with `RUNNER_UID` and `RUNNER_GID` set to another, and checks the runner user in each; `.github/workflows/runner-build.yml` runs it on amd64 and arm64 for changes to the image.
- **Canary a published fleet-role image:** `gh workflow run published-image-canary.yml --ref main -f image='ghcr.io/exadev/github-runner-fleet-role@sha256:<digest>' -f scenario=role_controller` runs the chosen role-controller scenario in the disposable mesh on a GitHub-hosted Linux amd64 runner. The image must be publicly pullable and digest-pinned. The scenario choices are `role_controller`, `role_controller_swap`, `role_swap`, `role_swap_paused`, `role_swap_blocked_peer` and `role_swap_refused`; each tests only its own behaviour and the image selected for that runner's architecture, not other platform images.
- **Compare two published fleet-role images:** `gh workflow run published-image-canary.yml --ref main -f image='ghcr.io/exadev/github-runner-fleet-role@sha256:<first-digest>' -f comparison_image='ghcr.io/exadev/github-runner-fleet-role@sha256:<second-digest>' -f scenario=role_controller` runs the selected scenario in ABBA order on one GitHub-hosted runner, rebuilding the disposable mesh each time. The `published-image-comparison` artifact contains each run's log and a TSV of image, scenario, outcome and elapsed seconds. The run fails if any scenario fails; timings include mesh setup and teardown, may reflect caching and runner contention, and are not a fleet benchmark. The job's GitHub-hosted limit can end a comparison before all runs finish.
Expand Down
2 changes: 1 addition & 1 deletion docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ A release:

The `[skip ci]` in the release commit message is deliberate: the image build already happens in this same run using the exact version semantic-release just decided, so there is nothing useful for a second, separately-triggered run of this workflow (or of `ci.yml`) to do against a commit that only changed a version stamp and a changelog - `ci.yml`'s own lint jobs already ran against every commit before it reached `main`.

The reference capability images in `tool-images/` are not part of a release. `.github/workflows/publish-tool-images.yml` builds each one natively on amd64 and arm64 runners and pushes it to `ghcr.io/<owner>/github-runner-toolcache-<name>`, `ghcr.io/<owner>/github-runner-sysroot-<name>` or `ghcr.io/<owner>/github-runner-runner-build`, tagged with the version its Dockerfile pins, when started by hand (`gh workflow run publish-tool-images.yml`) or by pushing a `tool-images-<anything>` tag. It leaves a version tag that already exists alone, and its run summary gives each pushed image's `<image>:<version>@sha256:<digest>` reference to pin in a capability or as a runner image. A new GitHub Container Registry package starts private; make it public in its package settings so pods can pull it without a credential. A build runner entry with a `runner_id` publishes the same image with its runner user at that uid and gid, tagged `<runner version>-uid<id>` (the ARC role README says when a fleet needs one).
The reference capability images in `tool-images/` are not part of a release. `.github/workflows/publish-tool-images.yml` builds each one natively on amd64 and arm64 runners and pushes it to `ghcr.io/<owner>/github-runner-toolcache-<name>`, `ghcr.io/<owner>/github-runner-sysroot-<name>` or `ghcr.io/<owner>/github-runner-runner-build`, tagged with the version its Dockerfile pins (followed by `-r<revision>` where it declares an `IMAGE_REVISION`), when started by hand (`gh workflow run publish-tool-images.yml`) or by pushing a `tool-images-<anything>` tag. It leaves a version tag that already exists alone, and its run summary gives each pushed image's `<image>:<version>@sha256:<digest>` reference to pin in a capability or as a runner image. A new GitHub Container Registry package starts private; make it public in its package settings so pods can pull it without a credential. A build runner entry with a `runner_id` publishes the same image with its runner user at that uid and gid, tagged `<runner version>-uid<id>` (the ARC role README says when a fleet needs one).

**What the release push needs:** a deploy key with write access on `ExaDev/github-runner`, whose private key is the `RELEASE_DEPLOY_KEY` repository secret `release.yml` checks out with. If `main` gains a ruleset, add deploy keys as its bypass actor so the release commit can land. Publishing to Ansible Galaxy additionally needs a `GALAXY_API_KEY` repository secret (an API key from `https://galaxy.ansible.com/me/preferences`); without it, the publish step logs that it's skipping and the release still completes.
Loading
Loading