# 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`. CI assigns ``: the next patch of the matrix entry's `base:` when the image's inputs changed. ## Versions and pins - **A published version is never moved and never rebuilt.** The build publishes only a version the registry does not have, and one whose inputs match the newest version's is not built; there is no `sha-*` tag, so one digest belongs to exactly one version. *Why:* a pin names exactly what a reviewer saw. *Held:* control: `scripts/next_image_version.py` and the tag lookup in `image.yml`'s prepare step. - **A pull request that changes an image input needs no version edit.** On `main`, `scripts/next_image_version.py` compares a checksum of the image's inputs (its build context, or the files its Dockerfile copies from the repository root) with the `net.rkdr.mortis.inputs-sha256` label of the newest published `.N`, and the build publishes `.N+1` when they differ. Edit `base:` by hand only for a minor or major. *Why:* a version a person must remember to raise is a version someone forgets. *Held:* control: the Images workflow assigns it (`next_image_version.py`, with its tests). - **After the build pushes a new version, a second pull request moves the `image:@sha256:` pins in `lint.yml`, `build.yml`, `molecule.yml` and `gitea-release-key.yml` to it.** Renovate opens it within minutes: the Images run's successful completion starts a live Renovate run (`workflow_run` in `renovate.yml`). It changes no image input, so it publishes nothing. 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`, and the `job_image` tag and digest. Digest drift within a release is tolerated. A `job_image`-only bump is not an image input: the post-merge Images run publishes nothing, and its prepare step is that bump's 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`, `created` and `net.rkdr.mortis.inputs-sha256`. 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; editing a label is, and publishes a new version. *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.