fix(image): act on the review of the image metadata
Build / build (pull_request) Failing after 10s
Lint / lint (pull_request) Successful in 13s
Molecule / molecule (pull_request) Successful in 58s

Label parser: split the LABEL instruction like a shell (a value may hold NAME=value text), read
the last stage only, require base.name and tie it to the FROM tag, require the documentation
link to be <source>/src/branch/main/docs/images/<name>.md and the page to be non-empty.
Docs: do not name a Python version the base may not ship, show the lint.yml pin check as it
is, say which workflow paths start a build, name the system-language local hooks, add the
apparmor option and the registry path to the molecule usage, and soften unverified Renovate
and host-release statements.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-10-26 19:32:03 +00:00
1 parent c3c665e799
commit aa1848a995
8 files changed
+142 -85

No files matched your search

+34 -17
View File
@@ -10,18 +10,24 @@ Ubuntu 26.04 with:
- **Python tools** in `/opt/venv` (on `PATH`), from `requirements-dev.txt`: `ansible-core`,
`ansible-lint`, `pre-commit`, `antsibull-changelog`, `galaxy-importer`, `reuse`.
- **Every pre-commit hook environment** of `.pre-commit-config.yaml` in `/opt/pre-commit`
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, pre-commit-hooks, actionlint and the
local hooks. The Go hooks are prebuilt; their toolchains are removed to keep layers small.
(`PRE_COMMIT_HOME`): conventional-pre-commit, gitleaks, yamllint, pre-commit-hooks and actionlint. The Go
hooks are prebuilt; their toolchains are removed to keep layers small. The local hooks (`reuse-lint`,
`antsibull-changelog-lint`, `ansible-lint`) are `language: system`: they run from `/opt/venv`, which is why
that directory must be on `PATH` (it is, in the image).
- **`ansible-test sanity` virtualenvs**, primed in `/root/.ansible/test`, and Python 3.11 and 3.13 as
`python3.11` / `python3.13` next to the distribution's 3.12, so sanity runs its compile test for all three.
- `git`, `shellcheck` (actionlint runs it over `run:` blocks) and `ca-certificates`.
`python3.11` / `python3.13` (python-build-standalone, installed with uv) next to the distribution's
`python3`, so sanity runs its compile test for those interpreters instead of skipping it.
- `git`, `shellcheck` (actionlint runs it over `run:` blocks), `python3`, `python3-venv` and `ca-certificates`.
The image runs as root and sets no working directory.
- `/opt/ci-pins.sha256`: the checksums of the two pin files this image was built from.
It has no Node, so JavaScript actions (`actions/checkout`) cannot run in it: clone with `git`.
## How to use it
As the job container of a workflow on the `kamino-docker` runner, pinned by tag and digest:
As the job container of a workflow on the `kamino-docker` runner, pinned by tag and digest. This is the
shape of `.gitea/workflows/lint.yml` (which also holds the checkout step with the job-token authentication the
private repository needs; read it for the full version):
```yaml
jobs:
@@ -32,35 +38,46 @@ jobs:
env:
PRE_COMMIT_HOME: /opt/pre-commit
steps:
- run: git clone "$REPO_URL" . && git checkout "$SHA" # see .gitea/workflows/lint.yml
- run: sha256sum --quiet -c /opt/ci-pins.sha256 && pre-commit run --all-files
# ... clone the repository and check out the commit (the image has no Node, so no actions/checkout)
- name: Check the baked tooling against the pins # run from the checkout root
run: |
if ! sha256sum --quiet -c /opt/ci-pins.sha256; then
/opt/venv/bin/pip install --quiet -r requirements-dev.txt # a pin changed: install the pinned tools
fi
- name: Run pre-commit on all files
run: |
export PATH="/opt/venv/bin:$PATH"
pre-commit run --all-files --show-diff-on-failure
```
A job first compares the checkout's `requirements-dev.txt` and `.pre-commit-config.yaml` with
`/opt/ci-pins.sha256`. When they match, the baked tools are used as they are. When a pull request changes a
pin, the check fails and the job installs the pinned tools itself for that run (slower, same result), until
the image is rebuilt from `main`. See `.gitea/workflows/lint.yml` and `build.yml`.
`/opt/ci-pins.sha256` lists the two pin files by relative name, so `sha256sum -c` runs in the checkout root. When
the checkout's `requirements-dev.txt` and `.pre-commit-config.yaml` match, the baked tools are used as they are.
When a pull request changes a pin the check fails and the job installs the pinned tools itself for that run
(slower, same result), until the image is rebuilt from `main`. `lint.yml` and `build.yml` are the real consumers.
## Tags and pinning
- `<version>` is semver, independent of the Collection's version. A published version is never moved or
rebuilt, so one digest belongs to exactly one version. `latest` is the newest version, for looking only.
- Pin `ci:<version>@sha256:<digest>`; the digest is what is enforced. Consumers: `lint.yml` and `build.yml`.
- Renovate moves the pins to a new version after the image is built on `main`.
- Renovate is configured to move the pins to a new version after the image is built on `main` (the rule is in
`renovate.json`; the first pin of a brand-new image is made by hand).
## How it is built and kept up to date
`.gitea/workflows/image.yml` builds it with kaniko (repository root as build context, because the pin
files are copied in) on every push to `main` that changes its inputs: `images/ci/`, `requirements-dev.txt`
or `.pre-commit-config.yaml`. Renovate's bump of one of those files carries the PATCH bump of the image
version, and the merge builds the image. Each pushed layer stays below 100 MB (Cloudflare's request limit),
which is why the Go toolchains are deleted from the hook cache.
files are copied in). The workflow runs on pushes to `main` that touch `images/**`, `requirements-dev.txt`,
`.pre-commit-config.yaml` or the workflow itself, never on a pull request, and builds an image only when its
`version:` in the workflow's matrix is not yet published. A change to the image's inputs therefore needs a new
`version:` (Lint enforces it, and Renovate's bump step does it for dependency updates), and the merge builds
the image. Each pushed layer stays below 100 MB (Cloudflare's request limit), which is why the Go toolchains
are deleted from the hook cache.
## Image metadata
The `org.opencontainers.image.*` labels (title, description, version, revision, created, source,
documentation, licenses, authors) and `net.rkdr.mortis.*` labels (what it is for, what it contains,
how to use it, the Ubuntu release) are listed on the package page of the registry; `version`,
how to use it; the base image is `base.name`) are listed on the package page of the registry; `version`,
`revision` and `created` are set by the build.
Source: [https://git.rkdr.net/mortis/kamino](https://git.rkdr.net/mortis/kamino), `images/ci/Dockerfile`. Licence: GPL-3.0-or-later.
+14 -10
View File
@@ -3,7 +3,7 @@
A disposable **Ubuntu 24.04** test target for the molecule scenarios of the
[`mortis.kamino`](https://git.rkdr.net/mortis/kamino) Ansible Collection: a container that behaves like a small
24.04 host (systemd as PID 1), so a role can be converged and verified in it without a VM.
It is the release most of the hosts run today.
It is the release of the home lab's LXC hosts today.
## What is in it
@@ -29,7 +29,7 @@ driver:
name: docker
platforms:
- name: instance
image: ${MOLECULE_IMAGE} # <name>:<version>@sha256:<digest>, set by .gitea/workflows/molecule.yml
image: ${MOLECULE_IMAGE} # git.rkdr.net/mortis/molecule-ubuntu2404:<version>@sha256:<digest>, set by molecule.yml
pre_build_image: true
pull: true
command: /sbin/init
@@ -45,7 +45,9 @@ platforms:
- apparmor=unconfined
```
systemd needs a writable cgroup, the firewall tools need `NET_ADMIN`, and nothing runs privileged.
systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the
firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and
nothing runs privileged. The docker driver needs molecule's docker plugin, which the runner provides.
The scenario `extensions/molecule/image-smoke` tests this image against that contract (release,
systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`).
@@ -57,21 +59,23 @@ systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`)
newest version and is for looking, not for pinning.
- Pin `molecule-ubuntu2404:<version>@sha256:<digest>`; the digest is what is enforced. Consumers here:
`.gitea/workflows/molecule.yml`.
- Renovate moves the pin to a new version after the image is built on `main`.
- Renovate is configured to move the pin to a new version after the image is built on `main` (the rule is in
`renovate.json`; the first pin of a brand-new image is made by hand).
## How it is built and kept up to date
`.gitea/workflows/image.yml` builds it with kaniko on every push to `main` that changes its inputs
(`images/molecule-ubuntu2404/`), never on a pull request. A change to the image needs a new `version:` in that
workflow's matrix (Renovate's bump step does it for dependency updates). The base image
and the Ubuntu release are fixed by the name: a new Ubuntu release is a new image
(`molecule-ubuntuNNNN`), and the roles are tested on every release the hosts run or are moving to.
`.gitea/workflows/image.yml` builds it with kaniko. The workflow runs on pushes to `main` that touch `images/**`,
`requirements-dev.txt`, `.pre-commit-config.yaml` or the workflow itself, never on a pull request, and builds an
image only when its `version:` in the workflow's matrix is not yet published. A change under
`images/molecule-ubuntu2404/` therefore needs a new `version:` (Lint enforces it) and the merge builds the image. The
Ubuntu release is fixed by the name: a new Ubuntu release is a new image (`molecule-ubuntuNNNN`), and the roles
are tested on every release the hosts run or are moving to.
## Image metadata
The `org.opencontainers.image.*` labels (title, description, version, revision, created, source,
documentation, licenses, authors) and `net.rkdr.mortis.*` labels (what it is for, what it contains,
how to use it, the Ubuntu release) are listed on the package page of the registry; `version`,
how to use it; the base image is `base.name`) are listed on the package page of the registry; `version`,
`revision` and `created` are set by the build.
Source: [https://git.rkdr.net/mortis/kamino](https://git.rkdr.net/mortis/kamino), `images/molecule-ubuntu2404/Dockerfile`. Licence: GPL-3.0-or-later.
+13 -9
View File
@@ -29,7 +29,7 @@ driver:
name: docker
platforms:
- name: instance
image: ${MOLECULE_IMAGE_2604} # <name>:<version>@sha256:<digest>, set by .gitea/workflows/molecule.yml
image: ${MOLECULE_IMAGE_2604} # git.rkdr.net/mortis/molecule-ubuntu2604:<version>@sha256:<digest>, set by molecule.yml
pre_build_image: true
pull: true
command: /sbin/init
@@ -45,7 +45,9 @@ platforms:
- apparmor=unconfined
```
systemd needs a writable cgroup, the firewall tools need `NET_ADMIN`, and nothing runs privileged.
systemd needs a writable cgroup (`cgroupns_mode: host`, the `/sys/fs/cgroup` mount and tmpfs on `/run`), the
firewall tools need `NET_ADMIN`, AppArmor is left unconfined for the container (`apparmor=unconfined`), and
nothing runs privileged. The docker driver needs molecule's docker plugin, which the runner provides.
The scenario `extensions/molecule/image-smoke-2604` tests this image against that contract (release,
systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`).
@@ -57,21 +59,23 @@ systemd, packages, the `dbus` and `ssh` units, the Python bindings, `NET_ADMIN`)
newest version and is for looking, not for pinning.
- Pin `molecule-ubuntu2604:<version>@sha256:<digest>`; the digest is what is enforced. Consumers here:
`.gitea/workflows/molecule.yml`.
- Renovate moves the pin to a new version after the image is built on `main`.
- Renovate is configured to move the pin to a new version after the image is built on `main` (the rule is in
`renovate.json`; the first pin of a brand-new image is made by hand).
## How it is built and kept up to date
`.gitea/workflows/image.yml` builds it with kaniko on every push to `main` that changes its inputs
(`images/molecule-ubuntu2604/`), never on a pull request. A change to the image needs a new `version:` in that
workflow's matrix (Renovate's bump step does it for dependency updates). The base image
and the Ubuntu release are fixed by the name: a new Ubuntu release is a new image
(`molecule-ubuntuNNNN`), and the roles are tested on every release the hosts run or are moving to.
`.gitea/workflows/image.yml` builds it with kaniko. The workflow runs on pushes to `main` that touch `images/**`,
`requirements-dev.txt`, `.pre-commit-config.yaml` or the workflow itself, never on a pull request, and builds an
image only when its `version:` in the workflow's matrix is not yet published. A change under
`images/molecule-ubuntu2604/` therefore needs a new `version:` (Lint enforces it) and the merge builds the image. The
Ubuntu release is fixed by the name: a new Ubuntu release is a new image (`molecule-ubuntuNNNN`), and the roles
are tested on every release the hosts run or are moving to.
## Image metadata
The `org.opencontainers.image.*` labels (title, description, version, revision, created, source,
documentation, licenses, authors) and `net.rkdr.mortis.*` labels (what it is for, what it contains,
how to use it, the Ubuntu release) are listed on the package page of the registry; `version`,
how to use it; the base image is `base.name`) are listed on the package page of the registry; `version`,
`revision` and `created` are set by the build.
Source: [https://git.rkdr.net/mortis/kamino](https://git.rkdr.net/mortis/kamino), `images/molecule-ubuntu2604/Dockerfile`. Licence: GPL-3.0-or-later.