test(molecule): bake prepare.yml fixtures into the molecule images #170

Open
opened 2026-11-15 14:29:31 +00:00 by Claude · 4 comments
Owner

Spec: CI image pipeline: keep, simplify or replace, resolution section 2, and Molecule and Renovate on the shared runner: isolation, capacity and cost, item 4 (narrowed by the final validation round of the map, #87 (comment), decision 4). This comes after refactor(images): image docs next to the images, check_image_versions.py pins only. The rule: bake in as much as possible, except what a role installs itself.

What

  • Packages a scenario's prepare.yml installs (for example roles/system_baseline/molecule/default/prepare.yml) are test fixtures. Move them into the molecule image and drop the install from prepare.yml, or keep it as a no-op assertion. The ufw package is the exception: see below.
  • Packages the role itself installs stay runtime downloads, because that install path is what the test exercises. Do not preinstall them (the docker role's Docker apt repository, for example).
  • Remove ufw and fail2ban from every molecule Dockerfile that exists when this lands (the Debian 13 one included): the ufw and fail2ban roles install them. openssh-server and iptables stay baked in, because no role installs them (the sshd role only writes configuration). Keep the fixtures that no role installs.
  • extensions/molecule/image-smoke*/verify.yml asserts all four packages; adjust it to match (only openssh-server and iptables remain).
  • The ufw and fail2ban roles install without refreshing the apt cache, and the image deletes its package lists. So an apt cache refresh is added to the prepare.yml of the ufw, fail2ban and traefik scenarios (the traefik scenario's converge runs mortis.kamino.ufw first), and to any other scenario that runs one of those two roles. Only system_baseline's prepare.yml refreshes the cache today. The ufw scenario's prepare.yml keeps its "Install ufw" task, after the refresh: it must exist before the role runs, because prepare seeds rules with community.general.ufw. The consequence: in the ufw scenario the package is present before the role runs, so the role's own install task is exercised only where another scenario runs the role on an image without it (the traefik scenario). Do not change the roles.
  • Remove "a converge makes no network calls" and the list of preinstalled role packages from each image's description label and from its image doc, and update the contents label and doc to the packages that remain.

Acceptance

  • The changed scenarios pass on 24.04 and 26.04.
  • Every role's scenario still passes once ufw and fail2ban are installed by their roles.
  • The prepare steps download nothing except the apt package lists and, in the ufw scenario, the ufw package.
Spec: [CI image pipeline: keep, simplify or replace](https://git.rkdr.net/Mortis/Kamino/issues/96), resolution section 2, and [Molecule and Renovate on the shared runner: isolation, capacity and cost](https://git.rkdr.net/Mortis/Kamino/issues/212), item 4 (narrowed by the final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281, decision 4). This comes after [refactor(images): image docs next to the images, check_image_versions.py pins only](https://git.rkdr.net/Mortis/Kamino/issues/169). The rule: bake in as much as possible, except what a role installs itself. ## What - Packages a scenario's `prepare.yml` installs (for example `roles/system_baseline/molecule/default/prepare.yml`) are test fixtures. Move them into the molecule image and drop the install from `prepare.yml`, or keep it as a no-op assertion. The `ufw` package is the exception: see below. - Packages **the role itself** installs stay runtime downloads, because that install path is what the test exercises. Do not preinstall them (the docker role's Docker apt repository, for example). - **Remove `ufw` and `fail2ban` from every molecule Dockerfile that exists when this lands** (the Debian 13 one included): the ufw and fail2ban roles install them. `openssh-server` and `iptables` stay baked in, because no role installs them (the `sshd` role only writes configuration). Keep the fixtures that no role installs. - `extensions/molecule/image-smoke*/verify.yml` asserts all four packages; adjust it to match (only `openssh-server` and `iptables` remain). - The ufw and fail2ban roles install without refreshing the apt cache, and the image deletes its package lists. So an apt cache refresh is **added** to the `prepare.yml` of the `ufw`, `fail2ban` and `traefik` scenarios (the `traefik` scenario's converge runs `mortis.kamino.ufw` first), and to any other scenario that runs one of those two roles. Only `system_baseline`'s `prepare.yml` refreshes the cache today. The `ufw` scenario's `prepare.yml` keeps its "Install ufw" task, after the refresh: it must exist before the role runs, because prepare seeds rules with `community.general.ufw`. The consequence: in the `ufw` scenario the package is present before the role runs, so the role's own install task is exercised only where another scenario runs the role on an image without it (the `traefik` scenario). Do not change the roles. - Remove "a converge makes no network calls" and the list of preinstalled role packages from each image's description label and from its image doc, and update the `contents` label and doc to the packages that remain. ## Acceptance - The changed scenarios pass on 24.04 and 26.04. - Every role's scenario still passes once `ufw` and `fail2ban` are installed by their roles. - The prepare steps download nothing except the apt package lists and, in the `ufw` scenario, the `ufw` package.
Claude added the
Status
Ready for Agent
label 2026-11-15 14:29:31 +00:00
Claude added this to the Continuous delivery milestone 2026-11-15 22:21:21 +00:00
Author
Owner

Scope added by Molecule and Renovate on the shared runner: isolation, capacity and cost, item 4. The rule is: bake in as much as possible, except what a role installs itself. So in the same change, remove the packages the roles manage (iptables, ufw, fail2ban, openssh-server) from both molecule Dockerfiles, and keep the fixtures that no role installs. Remove "a converge makes no network calls" and the list of preinstalled role packages from each image's description label and from its image doc. Bump each image version, since this is an image input. Check that every role's scenario still passes once its packages are installed by the role.

Scope added by [Molecule and Renovate on the shared runner: isolation, capacity and cost](https://git.rkdr.net/Mortis/Kamino/issues/212), item 4. The rule is: bake in as much as possible, except what a role installs itself. So in the same change, **remove the packages the roles manage** (`iptables`, `ufw`, `fail2ban`, `openssh-server`) from both molecule Dockerfiles, and keep the fixtures that no role installs. Remove "a converge makes no network calls" and the list of preinstalled role packages from each image's description label and from its image doc. Bump each image version, since this is an image input. Check that every role's scenario still passes once its packages are installed by the role.
Author
Owner

Review of the map (2026-11-17).

  • Package list. The comment of 2026-11-17 removes iptables, ufw, fail2ban and openssh-server. By the rule it states (bake in everything except what a role installs itself), only ufw and fail2ban come out: the ufw and fail2ban roles install them. No role installs openssh-server or iptables; the sshd role only writes configuration. Those two stay baked.
  • apt cache. The ufw and fail2ban roles install without refreshing the apt cache, and the image deletes its package lists. Each of those scenarios' prepare.yml refreshes the cache. Do not change the roles. Not run; it follows from the Dockerfile and the apt module.
  • Update extensions/molecule/image-smoke*/verify.yml, which assert all four packages.
  • "Bump each image version" no longer applies once ci(images): assign image versions in CI and open the pin PR right after a push has landed: CI assigns the version.
  • "Both molecule Dockerfiles" means every molecule Dockerfile that exists when this lands, the Debian 13 one included.
  • The body links the image layout issue by a title that no longer matches its scope (it no longer merges the Dockerfiles).
Review of the map (2026-11-17). - **Package list.** The comment of 2026-11-17 removes `iptables`, `ufw`, `fail2ban` and `openssh-server`. By the rule it states (bake in everything except what a role installs itself), only `ufw` and `fail2ban` come out: the ufw and fail2ban roles install them. No role installs `openssh-server` or `iptables`; the `sshd` role only writes configuration. Those two stay baked. - **apt cache.** The ufw and fail2ban roles install without refreshing the apt cache, and the image deletes its package lists. Each of those scenarios' `prepare.yml` refreshes the cache. Do not change the roles. Not run; it follows from the Dockerfile and the apt module. - Update `extensions/molecule/image-smoke*/verify.yml`, which assert all four packages. - "Bump each image version" no longer applies once [ci(images): assign image versions in CI and open the pin PR right after a push](https://git.rkdr.net/Mortis/Kamino/issues/165) has landed: CI assigns the version. - "Both molecule Dockerfiles" means every molecule Dockerfile that exists when this lands, the Debian 13 one included. - The body links the image layout issue by a title that no longer matches its scope (it no longer merges the Dockerfiles).
Author
Owner

Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, #87 (comment)). The body is the spec; the earlier comments are history.

  • Decision 4: only ufw and fail2ban leave the molecule images; openssh-server and iptables stay, image-smoke*/verify.yml is adjusted to match, and prepare.yml keeps the apt cache refresh (acceptance now "downloads no package").
  • The hand version bump is dropped (CI assigns versions after #165), and the link to the image layout issue uses its current title.
Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281). The body is the spec; the earlier comments are history. - Decision 4: only `ufw` and `fail2ban` leave the molecule images; `openssh-server` and `iptables` stay, `image-smoke*/verify.yml` is adjusted to match, and `prepare.yml` keeps the apt cache refresh (acceptance now "downloads no package"). - The hand version bump is dropped (CI assigns versions after #165), and the link to the image layout issue uses its current title.
Author
Owner

Final validation round, second pass (2026-11-20): body edited.

  • The first bullet no longer names roles/ufw/molecule/default/prepare.yml as a fixture to move into the image.
  • The apt-cache bullet now says a cache refresh is added (not kept) to the prepare.yml of the ufw, fail2ban and traefik scenarios (the traefik converge runs mortis.kamino.ufw) and any other scenario that runs one of those two roles. The ufw prepare keeps "Install ufw" after the refresh, with the consequence for the role's own install task stated.
  • Acceptance: the prepare steps download nothing except the apt package lists and, in the ufw scenario, the ufw package.
Final validation round, second pass (2026-11-20): body edited. - The first bullet no longer names `roles/ufw/molecule/default/prepare.yml` as a fixture to move into the image. - The apt-cache bullet now says a cache refresh is added (not kept) to the `prepare.yml` of the `ufw`, `fail2ban` and `traefik` scenarios (the traefik converge runs `mortis.kamino.ufw`) and any other scenario that runs one of those two roles. The `ufw` prepare keeps "Install ufw" after the refresh, with the consequence for the role's own install task stated. - Acceptance: the prepare steps download nothing except the apt package lists and, in the `ufw` scenario, the `ufw` package.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#170