Installing the job container's tools upgrades base packages once Ubuntu has newer ones, and the purge does not downgrade them, so the version check failed every image. Kaniko now empties the root filesystem and unpacks the base image before its first snapshot (--pre-cleanup), so the versions no longer matter. Extra packages and files no package owns still fail the job. With the filesystem emptied, a failed build can leave no rm for the last step, so the build step empties the credential file itself. The images also kept the base image's package versions. Each Dockerfile now upgrades them, and the base digests move to the newest published. Refs #508 Assisted-by: Claude Code
100 lines
7.0 KiB
Markdown
100 lines
7.0 KiB
Markdown
# Image rules
|
|
|
|
Every rule for the CI and test images in `images/` (`ci`, `molecule-controller`,
|
|
`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 `<version>` and `latest`. CI assigns
|
|
`<version>`: 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 `<base>.N`, and the build
|
|
publishes `<base>.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 its
|
|
`image:<version>@sha256:<digest>` pins to it:** `ci` in `lint.yml`, `build.yml` and
|
|
`gitea-release-key.yml`; `molecule-controller` and the `molecule-ubuntu*` images in `molecule.yml`. 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 target image (`molecule-ubuntu*`) 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:<release>@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:* control: on
|
|
the fast path Lint and Build cut the network by environment, so a download through pip or a
|
|
proxy-honouring client fails the job; review for a raw socket, for the script tests, which keep
|
|
network, and for Molecule.
|
|
- **Each Dockerfile upgrades the base image's packages in its first apt layer.** *Why:* Ubuntu
|
|
publishes package updates before it refreshes the base image. *Held:* review.
|
|
- **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/<name>.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.
|
|
- **`molecule-controller` has no image-smoke scenario: the last `RUN` of its Dockerfile checks
|
|
its tool versions, Docker driver, collections and pin checksums, and the full Molecule run of
|
|
its pin pull request proves the rest.** *Why:* it is the controller of every scenario, not a
|
|
target of one, so a full run tests it more than a scenario of its own could. *Held:* control: the self-checks fail the
|
|
build on `main`; review for the full run on the pin pull request.
|