# Image rules Every rule for the CI and test images in `images/` (`ci`, `molecule-ubuntu2404`, `molecule-ubuntu2604`), their build in `.gitea/workflows/image.yml`, and the image-smoke scenarios in `extensions/molecule/`, in full. Each gives its reason (*Why*) and how it is held (*Held*): a control names its hook or check; review means a person other than the author sees the change before it merges (`images/` and `.gitea/` are under `CODEOWNERS`); aspirational means nothing checks it. "Until X (#N) lands" names a change that is planned and its backlog issue. `image.yml` builds each image with kaniko on push to `main`, never on a pull request, and pushes it to this repository's organisation in the Gitea registry as `` and `latest`. ## Versions and pins - **A published version is never moved and never rebuilt.** The build looks the version up in the registry first and ends without building when it exists; there is no `sha-*` tag, so one digest belongs to exactly one version. *Why:* a pin names exactly what a reviewer saw. *Held:* control: the tag lookup in `image.yml`'s "Prepare kaniko and check the registry credential" step. - **A pull request that changes an image input (`requirements-dev.txt`, `requirements-dev.lock`, `requirements.yml`, `.pre-commit-config.yaml`, `images/**`) raises that image's `version:` (a PATCH bump) in the `image.yml` build matrix** (`python3 scripts/bump_image_versions.py` makes the edit). Until #165 assigns versions in CI. *Why:* a published version is never rebuilt, so a changed input needs a new version. *Held:* control: the Lint check's "Check image versions were bumped" step. - **After the merge builds the image, a second pull request moves the `image:@sha256:` pins in `lint.yml`, `build.yml`, `molecule.yml` and `gitea-release-key.yml` to the digest the build printed.** It touches no `image.yml` trigger path, so it rebuilds nothing. Renovate opens it for these images; a new image's first pin is a hand-made pull request, and a major version is moved by hand. *Why:* consumers run exactly the digest a reviewer saw. *Held:* review. - **Image-input bumps are no Collection release:** these files are in `galaxy.yml` `build_ignore`, and their bumps need no changelog fragment and no new `galaxy.yml` version. *Why:* they change neither the Collection nor what a consumer installs. *Held:* control for "not shipped": `scripts/check_tarball.py` in the Build check allows only Collection files in the archive; review for the version. ## Releases and the build container - **Each molecule image is one Ubuntu release, named after it; a new release is a new image, added by hand** (Renovate's major `ubuntu` updates are disabled). Roles are tested on every release a target host runs. *Why:* a role is only proven on the release it runs on. *Held:* review. - **Retire an image when no host runs its release.** *Why:* testing on a release nobody runs costs runner time and proves nothing. *Held:* aspirational. - **Each matrix entry's `job_image: ubuntu:@sha256:...` has the same release as the `FROM ubuntu:` of its Dockerfile.** Moving an image to a new release is one edit: the `FROM`, the `job_image` tag and digest, and the version bump. Digest drift within a release is tolerated. A `job_image`-only bump is not an image input: no version bump, nothing rebuilt; the post-merge Images run builds nothing past its prepare step for a published version, so that is its only exercise. *Why:* kaniko runs inside the job container and unpacks the image it builds over it. *Held:* control: `check_image_versions.py pins` in the Lint check. - **kaniko (the osscontainertools fork) is pinned by layer digests in `image.yml` and bumped by hand when that fork publishes a release.** *Why:* Renovate cannot compute the layer digests. *Held:* aspirational. ## Contents and size - **Bake in:** every tool, collection, hook environment and package a CI job uses is in its image; a job downloads at run time only on the slow path (a pull request that changes a pin file). *Why:* a run that downloads is slower and depends on the network. *Held:* review until the network-off check (#168) lands. - **Recorded speed:** a speed optimisation that adds machinery states its measured saving where it lives (a comment next to it). *Why:* machinery is kept only for a saving someone can check. *Held:* review. - **Every pushed layer stays below 100 MB; when you change an image, estimate each layer's compressed size and state the estimate in the pull request.** The `ci` build prints the compressed size of each layer directory, and the registry stores about 9% more. *Why:* Cloudflare rejects larger request bodies with HTTP 413. *Held:* aspirational; the push failing on `main` is the backstop, because there is no pull-request build, by the maintainer's choice. ## Metadata - **Each Dockerfile carries the same label block** (`org.opencontainers.image.*` plus `net.rkdr.mortis.purpose`, `contents` and `usage`); the build adds `version`, `revision` and `created`. The readme-style text lives in `docs/images/.md`, which the `documentation` label links to. *Why:* Gitea's package page shows the labels and links but renders no README. Editing that doc is not an image input and needs no new version; editing a label is and does. *Held:* control: `check_image_versions.py pins` fails when a label or the doc is missing. ## Image-smoke scenarios - **`extensions/molecule/image-smoke` and `image-smoke-2604` test the molecule images themselves** (24.04 and 26.04), including that each runs the release its name says. Their image comes from `MOLECULE_IMAGE` or `MOLECULE_IMAGE_2604` in `molecule.yml`, so a pin pull request runs them. *Why:* an image is proven by its own pin pull request before a role depends on it. *Held:* control: the scenarios, in the Molecule check.