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
2 changes: 2 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
echo "::error::${{ matrix.image }} uses $mb MB. The limit is 3072 MB."
exit 1
fi
- name: Check that jobs find rustup
run: docker run --rm -u runner size-check bash -c 'rustup show profile | grep -qx minimal && test -w ~/.rustup && test -w ~/.cargo'
- name: Keep the digest
if: github.event_name != 'pull_request'
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ If you do not have the old `secret.key`, the jobs, pools, users, and settings st

## Base images

Pools use `ghcr.io/runplane/runplane/runner-ubuntu-24.04` by default. The image contains Docker, Node.js, Python, Go, and the GitHub CLI. It also has a tool cache for `actions/setup-node`, `setup-python`, and `setup-go`. To add tools, make a custom image `FROM` the base image. Refer to [images/README.md](images/README.md).
Pools use `ghcr.io/runplane/runplane/runner-ubuntu-24.04` by default. The image contains Docker, Node.js, Python, Go, rustup, and the GitHub CLI. It also has a tool cache for `actions/setup-node`, `setup-python`, and `setup-go`. To add tools, make a custom image `FROM` the base image. Refer to [images/README.md](images/README.md).

If a server cannot pull the image from GHCR, runplane builds it on the server from the Dockerfile in its binary, with Docker. The first build takes some minutes. The check "Base image source" of `runplane doctor` shows which of the two the server does.

Expand Down
5 changes: 4 additions & 1 deletion images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ If runplane cannot pull a base image, it builds the image on the server from the
- The libraries of the GitHub Actions runner (ICU, OpenSSL, Kerberos, LTTng)
- The tool cache in `/opt/hostedtoolcache` with Node.js 22, 24, and 26, Python 3.11 to 3.14, and Go 1.27
- Node.js 24 from the tool cache as `node`, `npm`, `npx`, and `corepack` in `/usr/local/bin`
- rustup in the home folder of `runner`, with no Rust toolchain. `PATH` has `/home/runner/.cargo/bin`. A job installs the toolchain of its `rust-toolchain.toml` (`rustup toolchain install`), or runs `rustup default stable`
- The user `runner` (UID 1001) with sudo access without a password, in the `docker` group
- The locales `C.UTF-8` and `en_US.UTF-8`

Expand All @@ -37,6 +38,8 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
```

rustup and its toolchains belong to `runner`. To add a toolchain, run rustup as `runner`, for example `RUN runuser -u runner -- env HOME=/home/runner rustup default stable`.

To add a tool version to the tool cache, put it in `/opt/hostedtoolcache/<tool>/<version>/<arch>/`, and make the empty file `/opt/hostedtoolcache/<tool>/<version>/<arch>.complete`. The arch is `x64` or `arm64`. Then run `chown -R runner:runner /opt/hostedtoolcache`.

Obey these rules:
Expand Down Expand Up @@ -73,4 +76,4 @@ docker build -t runner-ubuntu-24.04 images/ubuntu-24.04

The Dockerfile installs the latest release of each tool version in `NODE_VERSIONS`, `PYTHON_VERSIONS`, and `GO_VERSIONS`. To change the versions, use `--build-arg`, for example `--build-arg NODE_VERSIONS="24 26"`.

The `images.yml` workflow builds the two images each week and fails if an image uses more than 3 GB.
The `images.yml` workflow builds the two images each week. It fails if an image uses more than 3 GB, or if `runner` cannot use rustup.
13 changes: 12 additions & 1 deletion images/ubuntu-24.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ENV LANG=C.UTF-8 \
TZ=Etc/UTC \
ImageOS=ubuntu24 \
RUNNER_TOOL_CACHE=/opt/hostedtoolcache \
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache \
PATH=/home/runner/.cargo/bin:$PATH

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

Expand Down Expand Up @@ -122,3 +123,13 @@ RUN case $(dpkg --print-architecture) in \
\
rm -rf /tmp/* /root/.cache; \
chown -R runner:runner "$RUNNER_TOOL_CACHE"

# rustup as on the GitHub-hosted runners, but with no toolchain: a stable
# toolchain adds 540 to 640 MB. A job installs the toolchain of its
# rust-toolchain.toml, or runs "rustup default stable". Login shells
# (su -, sudo -i) read PATH from /etc/environment, not from the ENV above.
RUN runuser -u runner -- env HOME=/home/runner bash -o pipefail -c \
'curl --proto =https --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y -q --no-modify-path \
--profile minimal --default-toolchain none'; \
sed -i 's|^PATH="|PATH="/home/runner/.cargo/bin:|' /etc/environment; \
grep -q '^PATH="/home/runner/.cargo/bin:' /etc/environment
13 changes: 12 additions & 1 deletion images/ubuntu-26.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ENV LANG=C.UTF-8 \
TZ=Etc/UTC \
ImageOS=ubuntu26 \
RUNNER_TOOL_CACHE=/opt/hostedtoolcache \
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache \
PATH=/home/runner/.cargo/bin:$PATH

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

Expand Down Expand Up @@ -122,3 +123,13 @@ RUN case $(dpkg --print-architecture) in \
\
rm -rf /tmp/* /root/.cache; \
chown -R runner:runner "$RUNNER_TOOL_CACHE"

# rustup as on the GitHub-hosted runners, but with no toolchain: a stable
# toolchain adds 540 to 640 MB. A job installs the toolchain of its
# rust-toolchain.toml, or runs "rustup default stable". Login shells
# (su -, sudo -i) read PATH from /etc/environment, not from the ENV above.
RUN runuser -u runner -- env HOME=/home/runner bash -o pipefail -c \
'curl --proto =https --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y -q --no-modify-path \
--profile minimal --default-toolchain none'; \
sed -i 's|^PATH="|PATH="/home/runner/.cargo/bin:|' /etc/environment; \
grep -q '^PATH="/home/runner/.cargo/bin:' /etc/environment
13 changes: 13 additions & 0 deletions init/vm_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ func setupVM() error {
return err
}
}
// devtmpfs has only device nodes. Docker (runc) and systemd add these
// links, and jobs need them: bash process substitution, <(...), reads
// /dev/fd/N. A kernel has one devtmpfs, so a link can already exist.
for name, target := range map[string]string{
"/dev/fd": "/proc/self/fd",
"/dev/stdin": "/proc/self/fd/0",
"/dev/stdout": "/proc/self/fd/1",
"/dev/stderr": "/proc/self/fd/2",
} {
if err := os.Symlink(target, name); err != nil && !errors.Is(err, os.ErrExist) {
return err
}
}
// /tmp stays on the scratch disk through the root overlay: jobs write
// large temporary files, and a tmpfs would take them from VM memory.
if err := os.Chmod("/tmp", 0o777|os.ModeSticky); err != nil {
Expand Down
Loading