Files
Kamino/docs/images/ci.md
Defame1297 39ec8e5b3c build(ci): drop molecule's Docker driver and community.docker from the ci image
Molecule runs in the molecule-controller image. In the ci image, only
Lint's "Test the repository scripts" step uses molecule:
test_check_scenarios_load_checkout.py runs check_scenarios_load_checkout.py,
which imports molecule's config lookup, and test_run_molecule_scenarios.py
expands platform names with molecule's interpolator. Both skip silently
without molecule, so molecule stays, with a comment naming the step.

Nothing in Lint or Build uses the Docker driver (molecule-plugins[docker])
or the docker SDK it pulls in: those tests use molecule's default driver
and a stub docker module. No linted file calls a community.docker module,
and a local clone, which never installs extensions/molecule/requirements.yml,
passes ansible-lint. So the driver, docker, selinux and community.docker
leave the ci image, and extensions/molecule/requirements.yml leaves its
pin record: a community.docker bump no longer publishes a ci version.

The lock is regenerated with scripts/lock-requirements.sh. Every script
test passes, none skipped, in a venv installed from the new lock.

Assisted-by: Claude Code
2026-12-02 08:43:39 +00:00

6.4 KiB

ci

The CI tooling image of the mortis.kamino Collection: everything the Lint and Build workflows used to install on each run is baked in, so a job only checks out the code and runs. The Molecule workflow runs in the molecule-controller image instead (ADR 0003), so a tool bump only Lint uses selects no Molecule scenario.

What is in it

Ubuntu 26.04 with:

  • Python tools in /opt/venv (on PATH; it runs on Python 3.14, the version of .python-version, from the baked copy and not from the distribution's python3), from requirements-dev.lock (the hashed lock of requirements-dev.txt, installed with pip install --require-hashes): ansible-core, ansible-lint, pre-commit, antsibull-changelog, galaxy-importer, reuse, molecule (without its Docker driver: Lint's "Test the repository scripts" step runs the tests that import it), and proxmoxer, the controller-side library the modules of community.proxmox import.
  • The collections the roles call in /opt/collections (ANSIBLE_COLLECTIONS_PATH is set to it), from requirements.yml: community.general, ansible.posix and community.proxmox at the exact versions CI tests against, so ansible-lint --offline resolves their modules instead of mocking them.
  • Every pre-commit hook environment of .pre-commit-config.yaml in /opt/pre-commit (PRE_COMMIT_HOME): conventional-pre-commit, gitleaks, yamllint, ruff, shellcheck-py, pre-commit-hooks, actionlint and zizmor. The Go hooks are prebuilt; their toolchains, and the binaries of those repositories that no hook runs, 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, 3.13 and 3.14 as python3.11 / python3.13 / python3.14 (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 four 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. This is the shape of .gitea/workflows/lint.yml (which also holds the checkout step with the job-token authentication the repository needs; read it for the full version):

jobs:
  lint:
    runs-on: kamino-docker
    container:
      image: git.rkdr.net/mortis/ci:<version>@sha256:<digest>
    env:
      PRE_COMMIT_HOME: /opt/pre-commit
      ANSIBLE_COLLECTIONS_PATH: /opt/collections
    steps:
      # ... 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 --require-hashes -r requirements-dev.lock -r requirements-dev.txt   # a pin changed: install the pinned tools
            /opt/venv/bin/ansible-galaxy collection install --force -r requirements.yml -p "$ANSIBLE_COLLECTIONS_PATH"
          fi
      - name: Run pre-commit on all files
        run: |
          export PATH="/opt/venv/bin:$PATH"
          pre-commit run --all-files --show-diff-on-failure

/opt/ci-pins.sha256 lists the four pin files by their checkout-relative path, so sha256sum -c runs in the checkout root. When the checkout's requirements-dev.txt, requirements-dev.lock, requirements.yml and .pre-commit-config.yaml match, the baked tools and collections are used as they are, and Lint and Build cut the network by environment (proxy variables and PIP_NO_INDEX) for all but the script tests, so a tool that downloads at run time fails the job. When a pull request changes a pin the check fails and the job installs the pinned tools and collections itself for that run (slower, same result), until the image is rebuilt from main. lint.yml, build.yml and gitea-release-key.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 decides what is pulled. Consumers: lint.yml, build.yml and gitea-release-key.yml.
  • 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). The workflow runs on pushes to main that touch images/**, requirements-dev.txt, requirements-dev.lock, requirements.yml, extensions/molecule/requirements.yml, .pre-commit-config.yaml or the workflow itself, never on a pull request, and builds an image only when its inputs differ from those of its newest published version (scripts/next_image_version.py compares a checksum label). It then publishes the next patch of the matrix's base:, and Renovate opens the pull request that moves the pins to it. Each pushed layer stays below 100 MB (Cloudflare's request limit), which is why the Go toolchains and the unused Go binaries are deleted from the hook cache, and why the build prints the compressed size of each layer directory.

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 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, images/ci/Dockerfile. Licence: GPL-3.0-or-later.