From a7f9769a824ec3ae49f65d0a3c2630261b062fc7 Mon Sep 17 00:00:00 2001 From: fristyxd Date: Fri, 20 Nov 2026 14:35:30 +0300 Subject: [PATCH] fix: upgrade base packages and npm to clear the image scan apt-get upgrade keeps buildpack-deps from freezing linux-libc-dev at the version the base image shipped with; five CRITICAL kernel CVEs in that package alone failed the 24.04 publish. npm 11.21.3 replaces the undici 6.28.0 and brace-expansion 5.0.9 bundled with node 26.13.1, 12 HIGH findings. The npm tree is copied back into the tool cache because the in-place upgrade breaks its hardlink. Release pipeline: each main build now cuts the next patch from the newest v* tag, publishes v-ubuntu- next to the moving ubuntu- tags, and only tags the commit after every base has published, so a failed scan can no longer leave a half published version. The v0.0.0-dev. fallback is gone. Docs: README no longer pins tool versions that Renovate already tracks, and the image tags, versioning and commit conventions are written down. --- .gitea/workflows/build.yaml | 2 -- .gitea/workflows/release.yaml | 53 ++++++++++++++++++++++++++++++----- CHANGELOG.md | 31 ++++++++++++++++---- CONTRIBUTING.md | 28 ++++++++++++------ README.md | 47 ++++++++++++++++++++----------- dockerfiles/ubuntu.dockerfile | 21 ++++++-------- 6 files changed, 131 insertions(+), 51 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 0336899..62c38e3 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -11,8 +11,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -# Builds, scans and smoke tests the images without publishing anything. - jobs: build: runs-on: ubuntu-latest diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index c96871e..d61b12f 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -3,14 +3,16 @@ name: release on: push: branches: [main] - tags: ["v*"] schedule: - cron: "0 3 1 * *" workflow_dispatch: + inputs: + version: + description: "Release to cut, e.g. v1.1.0. Empty means the next patch." + required: false permissions: contents: read - packages: write concurrency: group: release @@ -20,6 +22,8 @@ env: REGISTRY: git.fristy.net IMAGE: git.fristy.net/actions/runner-images +# Each run on main cuts a patch release and tags the commit afterwards. A tag +# push does not trigger this workflow, so the tag cannot loop back. jobs: meta: runs-on: ubuntu-latest @@ -27,15 +31,28 @@ jobs: created: ${{ steps.meta.outputs.created }} version: ${{ steps.meta.outputs.version }} steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Get meta id: meta run: | echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" - if [ "${GITHUB_REF_TYPE}" = "tag" ]; then - version="${GITHUB_REF_NAME}" + latest="$(git tag --list 'v*' --sort=-v:refname | head -n1)" + if [ -z "${latest}" ]; then + next="v1.0.0" else - version="v0.0.0-dev.$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" + next="v$(awk -F. '{print $1"."$2"."$3+1}' <<< "${latest#v}")" fi + override='${{ github.event.inputs.version }}' + [ "${override}" = "null" ] && override='' + version="${override:-${next}}" + [[ "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { + echo "invalid version '${version}', expected v.." >&2 + exit 1 + } echo "version=${version}" >> "$GITHUB_OUTPUT" publish: @@ -101,10 +118,32 @@ jobs: - name: Push ${{ matrix.base }} run: | set -euo pipefail + version="${{ needs.meta.outputs.version }}" printf '%s\n' "${{ matrix.tags }}" | tr ',' '\n' | while read -r tag; do [ -n "${tag}" ] || continue docker tag "${IMAGE}:ubuntu-${{ matrix.base }}" "${IMAGE}:${tag}" docker push "${IMAGE}:${tag}" done - docker tag "${IMAGE}:ubuntu-${{ matrix.base }}" "${IMAGE}:${{ needs.meta.outputs.version }}-${{ matrix.base }}" - docker push "${IMAGE}:${{ needs.meta.outputs.version }}-${{ matrix.base }}" + docker tag "${IMAGE}:ubuntu-${{ matrix.base }}" "${IMAGE}:${version}-ubuntu-${{ matrix.base }}" + docker push "${IMAGE}:${version}-ubuntu-${{ matrix.base }}" + + tag: + needs: [meta, publish] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Tag the release + run: | + version="${{ needs.meta.outputs.version }}" + if git rev-parse -q --verify "refs/tags/${version}" > /dev/null; then + echo "${version} is already tagged" + exit 0 + fi + git tag -a "${version}" -m "${version}" "${GITHUB_SHA}" + git push origin "refs/tags/${version}" diff --git a/CHANGELOG.md b/CHANGELOG.md index d4171fe..3407176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project are documented in this file. The format is based on [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.0.1] - 2026-11-20 ### Fixed @@ -20,16 +20,37 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/ - tea is looked up through `gitea-releases`: `github.com/gitea/tea` does not exist, so every Renovate run reported a package lookup failure for it. +### Security + +- The build runs `apt-get upgrade` before installing anything else, so the image + no longer inherits the base packages frozen into `buildpack-deps` at its + publish time. The 24.04 image was failing its CRITICAL scan on + `linux-libc-dev` for exactly that reason. + ### Changed +- Images carry an immutable `v-ubuntu-` tag next to the moving + `ubuntu-` tags. Each `main` build cuts the next patch version from the + newest `v*` tag and tags the commit once every base has published; minor and + major releases start the workflow by hand with `version` set. The + `v0.0.0-dev.` tags are gone. - zig is no longer annotated for Renovate: no datasource publishes ziglang.org releases, so `ZIG_VERSION` is bumped by hand. -- pnpm 12.16.1 to 12.18.0. -- nfpm 2.48.0 to 2.49.0. - Renovate merges minor, patch, pin and digest updates on its own once the branch is green and the release is two days old; major and breaking updates still wait for a review. trivy and OSV-reported security fixes skip the release-age wait. +- node 26.13.0 to 26.13.1. +- npm 11.20.0 to 11.21.3, now pinned and tracked by Renovate: the npm bundled + with node 26.13.1 shipped undici 6.28.0 and brace-expansion 5.0.9, which were + 12 of the HIGH findings in the image scan. +- pnpm 12.16.1 to 12.21.0. +- yq v4.54.1 to v4.54.3. +- Go 1.27.3 to 1.27.4. +- gh 2.103.3 to 2.105.0. +- trivy 0.76.1 to 0.76.2. +- nfpm 2.48.0 to 2.49.0. +- cargo-zigbuild 0.24.0 to 0.24.1. ## [1.0.0] - 2026-10-31 @@ -49,5 +70,5 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/ - `build.yaml` (pull requests, no publishing) and `release.yaml` (publish on `main`, on `v*` tags, monthly, or on demand). -[Unreleased]: https://git.fristy.net/actions/runner-images/compare/v1.0.0...main -[1.0.0]: https://git.fristy.net/actions/runner-images/releases/tag/v1.0.0 +[1.0.1]: https://git.fristy.net/actions/runner-images/compare/v1.0.0...v1.0.1 +[1.0.0]: https://git.fristy.net/actions/runner-images/src/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d84f2bb..bc52864 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,8 +30,6 @@ explain the why. the same pull request. - **Architecture:** the build matrix is `linux/amd64`. The Dockerfile maps `TARGETARCH` for `arm64` as well, so keep it working when you add downloads. -- **Commits:** short imperative subject, body explains the reason. Add - `Signed-off-by:` if you can (DCO-style, no CLA). ## Branch names @@ -46,24 +44,38 @@ docs/ README, CONTRIBUTING, SECURITY No long-lived branches besides `main`; delete the branch after the merge. +## Commits + +We follow [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/): +`type(optional scope): summary` in the imperative, the reason in the body. + +``` +feat: bake gh into the image +fix(dockerfile): keep the Go checksum lookup working +chore(deps): update runner tool versions +docs: explain the image tags +``` + +Add `Signed-off-by:` if you can (DCO-style, no CLA). A breaking change takes a +`!` after the type or a `BREAKING CHANGE:` footer, and that is a major release. + ## Versioning The repository follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) -for its own releases (`vMAJOR.MINOR.PATCH` git tags, published from `release.yaml`): +for its own releases: - **MAJOR** — a tag disappears, an image stops shipping a tool workflows depend on. - **MINOR** — a new base tag, a new tool or a new cache layout. - **PATCH** — version bumps of the tools already inside, rebuilds for base updates. -The image tags themselves (`ubuntu-24.04`, `ubuntu-latest`, …) follow the Ubuntu -release they are built on and are not versioned. `IMAGE_VERSION` records the -SemVer tag when the build comes from a `v*` tag, otherwise -`v0.0.0-dev.`. +Every run on `main` cuts the next patch: `release.yaml` publishes +`v-ubuntu-` next to the moving `ubuntu-` tags, then tags the +commit. Minor and major releases start that workflow by hand with `version` set. +`IMAGE_VERSION` records the version the image was built as. Changes are recorded in [CHANGELOG.md](CHANGELOG.md), which follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). - ## Testing locally ```bash diff --git a/README.md b/README.md index 98987be..4dcc160 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ things on every single run: | Workflow step | What it fetched | Where from | |---|---|---| -| `actions/setup-node` | node 26.13.0 / 22 | **GitHub API** | -| `actions/setup-python` | python 3.15 | **GitHub API** | -| `pnpm/action-setup` | pnpm 12.16.1 | npm registry | +| `actions/setup-node` | node 26.x | **GitHub API** | +| `actions/setup-python` | python 3.x | **GitHub API** | +| `pnpm/action-setup` | pnpm 12.x | npm registry | | `dtolnay/rust-toolchain` | rustup + toolchain | static.rust-lang.org | | release job | zig, cargo-zigbuild, nfpm | ziglang.org, GitHub | | ci job | trivy (install.sh) | GitHub | @@ -25,7 +25,9 @@ things on every single run: The two rows marked **GitHub API** share one anonymous quota of ~60 requests per hour per IP. Several CI runs in the same hour exhausted it and jobs started dying inside `Setup Node` before anything was compiled. Baking the tools into the image -removes the downloads entirely, so the quota no longer matters. +removes the downloads entirely, so the quota no longer matters. The table names +the major line only; the exact pin lives in the Dockerfile (see +[Versions](#versions)). Differences from `gitea/runner-images`: @@ -39,7 +41,7 @@ Differences from `gitea/runner-images`: | Tool | Notes | |---|---| -| node 26.13.0 | installed into `RUNNER_TOOL_CACHE` and hard linked into `/usr/local`, so `setup-node` never downloads it | +| node 26.x | installed into `RUNNER_TOOL_CACHE` and hard linked into `/usr/local`, so `setup-node` never downloads it | | npm, pnpm, corepack | global installs on top of node | | python3 + pip + pipx | `yamllint` comes from pipx | | docker CLI + buildx + compose plugin | jobs talk to the host daemon through the mounted socket | @@ -47,25 +49,36 @@ Differences from `gitea/runner-images`: | go, rust (rustup), cargo-zigbuild, zig | cross builds for `aarch64-unknown-linux-musl` | | gh, trivy, nfpm | release tooling | -Versions are pinned as `ARG`s with `# renovate:` annotations, so Renovate bumps -them and the image stays reproducible. +## Versions + +Each tool is pinned to an exact version in a `# renovate:`-annotated `ARG` in +[dockerfiles/ubuntu.dockerfile](dockerfiles/ubuntu.dockerfile). Renovate keeps +those pins current, so this README names only the major line and does not go +stale when a patch is released. ## Tags -| Tag | Base | +| Tag | Meaning | |---|---| -| `ubuntu-latest` | Ubuntu 26.10 | -| `ubuntu-26.10` | Ubuntu 26.10 | -| `ubuntu-26.04` | Ubuntu 26.04 LTS | -| `ubuntu-24.04` | Ubuntu 24.04 LTS | +| `ubuntu-latest` | newest base (Ubuntu 26.10) | +| `ubuntu-26.10`, `ubuntu-26.04`, `ubuntu-24.04` | moving: newest build for that base | +| `v1.0.1-ubuntu-26.10` | immutable: one release, one base | + +Every successful run on `main` — including the monthly rebuild — cuts the next +patch version from the newest `v*` tag, pushes `-ubuntu-` next to +the moving tags, and only then tags the commit with ``. Nothing is +published under a version tag when a base fails its scan. + +For a minor or major release, start the `release` workflow by hand with +`version` set (for example `v1.1.0`); the same run publishes and tags it. Images are `linux/amd64` only for now. The Dockerfile already handles `arm64` (`TARGETARCH`), it is just not in the build matrix. -The repository itself is released with [Semantic Versioning](https://semver.org/spec/v2.0.0.html) -tags; changes land in [CHANGELOG.md](CHANGELOG.md) following -[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Image tags follow the -Ubuntu release instead and are not versioned. +The repository follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html): +dependency bumps are patch releases, new bases or tools are minor, and breaking +changes are major. Changes land in [CHANGELOG.md](CHANGELOG.md) following +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## Using an image @@ -93,4 +106,4 @@ docker run --rm -i runner-images:ubuntu-26.10 bash -s -- 26.10 < tests/default.s `build.yaml` does exactly this for every tag in the matrix on pull requests; `release.yaml` publishes to `git.fristy.net/actions/runner-images` on `main`, -on `v*` tags, monthly, or on demand. +monthly, or on demand. diff --git a/dockerfiles/ubuntu.dockerfile b/dockerfiles/ubuntu.dockerfile index e9a953b..3028f8c 100644 --- a/dockerfiles/ubuntu.dockerfile +++ b/dockerfiles/ubuntu.dockerfile @@ -1,11 +1,4 @@ # syntax=docker/dockerfile:1 -# -# Ubuntu runner image for our Gitea Actions runners. -# -# Every tool a workflow would otherwise download on each run is baked in: -# node, pnpm, corepack, python, docker CLI + buildx + compose, git, jq, yq, tea, -# go, rust (with the musl target and cargo-zigbuild), gh, trivy, nfpm and zig. -# Actions/setup-node finds node in RUNNER_TOOL_CACHE, so it never hits GitHub. ARG BASE_IMAGE_TAG=26.10 @@ -16,6 +9,8 @@ ARG BASE_IMAGE_TAG # renovate: datasource=node-version depName=node ARG NODE_VERSION=26.13.1 +# renovate: datasource=npm depName=npm +ARG NPM_VERSION=11.21.3 # renovate: datasource=npm depName=pnpm ARG PNPM_VERSION=12.21.0 # renovate: datasource=npm depName=corepack @@ -66,7 +61,7 @@ RUN case "${TARGETARCH}" in \ && echo "${trivy_arch}" > /tmp/trivy_arch \ && echo "${zig_arch}" > /tmp/zig_arch -# Base packages. buildpack-deps already brings compilers, curl, git and the usual libraries. +# buildpack-deps already brings compilers, curl and git; add only the gaps. RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries \ && apt-get update \ && apt-get install -y --no-install-recommends \ @@ -98,6 +93,7 @@ RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries \ xz-utils \ zip \ zstd \ + && apt-get upgrade -y \ && . /etc/os-release \ && install -m 0755 -d /etc/apt/keyrings \ && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \ @@ -114,8 +110,7 @@ RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries \ && chmod -R 777 /opt/pipx /opt/pipx_bin \ && rm -rf ~/.cache -# Node goes into the tool cache for setup-node and is hard linked into /usr/local, -# so a shared tool-cache volume cannot hide it. +# npm upgrades break the hardlink, so the tool-cache copy is replaced below. RUN node_arch="$(cat /tmp/node_arch)" \ && cd /tmp \ && base_url="https://nodejs.org/dist/v${NODE_VERSION}" \ @@ -131,8 +126,11 @@ RUN node_arch="$(cat /tmp/node_arch)" \ && cp -al "${node_dir}/bin" "${node_dir}/include" "${node_dir}/lib" "${node_dir}/share" /usr/local/ \ && rm -f "${tarball}" SHASUMS256.txt \ && node --version \ - && npm install -g "pnpm@${PNPM_VERSION}" "corepack@${COREPACK_VERSION}" \ + && npm install -g "npm@${NPM_VERSION}" "pnpm@${PNPM_VERSION}" "corepack@${COREPACK_VERSION}" \ + && rm -rf "${node_dir}/lib/node_modules/npm" \ + && cp -a /usr/local/lib/node_modules/npm "${node_dir}/lib/node_modules/npm" \ && rm -rf ~/.npm \ + && npm --version \ && pnpm --version \ && corepack --version @@ -227,7 +225,6 @@ RUN arch="$(cat /tmp/arch)" \ && cargo --version \ && cargo zigbuild --help > /dev/null -# Runner plumbing: work dir, ssh known hosts, tool cache permissions. RUN mkdir -m 0777 -p /github /opt/hostedtoolcache \ && mkdir -m 0700 -p ~/.ssh \ && ssh-keyscan -t rsa,ecdsa,ed25519 github.com gitea.com >> /etc/ssh/ssh_known_hosts \ -- 2.54.1