feat(molecule): add the molecule workflow and an image smoke scenario #10

Merged
Defame1297 merged 5 commits from feat/molecule-workflow into main 2026-10-25 12:34:33 +00:00
Owner

Why

The Collection has no behavioural CI yet, and the roles of wave 1 will need it. The test image (molecule-ubuntu2404:0.1.0) is published; this adds the workflow that uses it, and a scenario that tests the image itself so the pipeline is proven before any role exists.

Change

  • .gitea/workflows/molecule.yml: runs on kamino-molecule, the runner's host-executor label (the runner's own Docker daemon; no job container, no socket handed out). It checks the provisioned tooling (/opt/molecule-venv, Docker), clones the commit to ac/ansible_collections/mortis/kamino so FQCNs resolve, and runs every discovered scenario: extensions/molecule/*/ and roles/*/molecule/*/ (so a role only adds its scenario directory). It fails if none is found. Triggers: same-repo PRs and pushes to main touching roles/ extensions/ plugins/ meta/ galaxy.yml or the workflow; manual dispatch. Ref and repo values reach the script via env, not interpolation.
  • The image is git.rkdr.net/mortis/molecule-ubuntu2404:0.1.0@sha256:80dbfa7f88309072e954ae20e80ee8171bd750abc7c1d9563c746bf6f0121f04 in the job env as MOLECULE_IMAGE; scenarios use image: ${MOLECULE_IMAGE} with pull: true. Bump tag and digest together when image.yml publishes a new version.
  • extensions/molecule/image-smoke/: converge is a ping; verify asserts Ubuntu 24.04, systemd as service manager, the packages the roles manage (systemd, dbus, sudo, iproute2, python3-apt, python3-systemd, iptables, ufw, fail2ban, openssh-server, ...), dbus active and ssh enabled, import apt, systemd.journal, and iptables -S (NET_ADMIN granted).

Checked

  • The runner has the molecule 26.10.0 venv, ansible-core 2.19.14, the collections in /opt/molecule-collections, and Docker usable by gitea-runner (in the docker group).
  • ansible-lint (production profile, repo config) on the scenario files: one name[casing] finding, fixed here.

Not verified until this PR's own run

That molecule test -s image-smoke works from the collection root with extensions/molecule discovery, that the image pulls by tag+digest on the runner's Docker, and that systemd comes up in the runner's nested container. The PR's molecule run (its workflow file comes from the head) is the test.

Security

Host executor = root-equivalent on the runner, which is rebuildable and holds no production secret: the repo stays private and takes no fork PRs (the if: also limits it to same-repo, non-Renovate branches).

🤖 Generated with Claude Code

## Why The Collection has no behavioural CI yet, and the roles of wave 1 will need it. The test image (`molecule-ubuntu2404:0.1.0`) is published; this adds the workflow that uses it, and a scenario that tests the image itself so the pipeline is proven before any role exists. ## Change - `.gitea/workflows/molecule.yml`: runs on `kamino-molecule`, the runner's host-executor label (the runner's own Docker daemon; no job container, no socket handed out). It checks the provisioned tooling (`/opt/molecule-venv`, Docker), clones the commit to `ac/ansible_collections/mortis/kamino` so FQCNs resolve, and runs every discovered scenario: `extensions/molecule/*/` and `roles/*/molecule/*/` (so a role only adds its scenario directory). It fails if none is found. Triggers: same-repo PRs and pushes to `main` touching `roles/ extensions/ plugins/ meta/ galaxy.yml` or the workflow; manual dispatch. Ref and repo values reach the script via env, not interpolation. - The image is `git.rkdr.net/mortis/molecule-ubuntu2404:0.1.0@sha256:80dbfa7f88309072e954ae20e80ee8171bd750abc7c1d9563c746bf6f0121f04` in the job env as `MOLECULE_IMAGE`; scenarios use `image: ${MOLECULE_IMAGE}` with `pull: true`. Bump tag and digest together when `image.yml` publishes a new version. - `extensions/molecule/image-smoke/`: converge is a ping; verify asserts Ubuntu 24.04, systemd as service manager, the packages the roles manage (systemd, dbus, sudo, iproute2, python3-apt, python3-systemd, iptables, ufw, fail2ban, openssh-server, ...), dbus active and ssh enabled, `import apt, systemd.journal`, and `iptables -S` (NET_ADMIN granted). ## Checked - The runner has the molecule 26.10.0 venv, ansible-core 2.19.14, the collections in `/opt/molecule-collections`, and Docker usable by `gitea-runner` (in the `docker` group). - ansible-lint (production profile, repo config) on the scenario files: one `name[casing]` finding, fixed here. ## Not verified until this PR's own run That `molecule test -s image-smoke` works from the collection root with `extensions/molecule` discovery, that the image pulls by tag+digest on the runner's Docker, and that systemd comes up in the runner's nested container. The PR's molecule run (its workflow file comes from the head) is the test. ## Security Host executor = root-equivalent on the runner, which is rebuildable and holds no production secret: the repo stays private and takes no fork PRs (the `if:` also limits it to same-repo, non-Renovate branches). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 2 commits 2026-10-25 12:12:33 +00:00
.gitea/workflows/molecule.yml runs every molecule scenario of the Collection
on the kamino-molecule host-executor label of kamino-runner (the Docker
daemon of the runner LXC, no job container, no Docker socket handed out),
against the molecule-ubuntu2404 image pinned by tag and digest. Scenarios are
discovered: extensions/molecule/*/ and roles/*/molecule/*/, so the wave-1 roles
only add their scenario directory.

extensions/molecule/image-smoke tests the image itself: Ubuntu 24.04, systemd
as PID 1 and reachable over the container connection, the packages the roles
manage, ssh enabled, the python bindings Ansible needs, NET_ADMIN. A rebuilt
or re-pinned image therefore has to pass before a role scenario trusts it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
fix(molecule): capitalise a task name and repeat the paths instead of using an anchor
Build / build (pull_request) Successful in 24s
Lint / lint (pull_request) Failing after 5s
Molecule / molecule (pull_request) Successful in 35s
29278e9625
ansible-lint name[casing] on the smoke verify task; and the workflow trigger
paths are written out for both events (YAML anchors in an `on:` block are not
something to rely on in Gitea's workflow parser).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Claude added 1 commit 2026-10-25 12:14:54 +00:00
fix(molecule): satisfy yamllint and shellcheck, and keep molecule's collection install job-local
Build / build (pull_request) Successful in 24s
Lint / lint (pull_request) Failing after 5s
Molecule / molecule (pull_request) Successful in 34s
0211a63923
yamllint line-length on the MOLECULE_IMAGE value (166 > 160) and shellcheck
SC2155 on the export. And: the first run showed molecule installing the
collection under test into the runner user's ~/.ansible/collections and warning
about the duplicate in the job tree. That copy outlives the job and the version
stays 0.1.0, so a later run could resolve a stale one. ANSIBLE_HOME now points
into the job tree, and a copy left by earlier runs is removed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 added 1 commit 2026-10-25 12:18:13 +00:00
Merge branch 'main' into feat/molecule-workflow
Build / build (pull_request) Successful in 24s
Lint / lint (pull_request) Failing after 5s
Molecule / molecule (pull_request) Successful in 29s
54c7826934
Claude added 1 commit 2026-10-25 12:31:56 +00:00
fix(molecule): wrap the tooling check line that exceeds the yamllint line length
Build / build (pull_request) Successful in 24s
Lint / lint (pull_request) Successful in 5s
Molecule / molecule (pull_request) Successful in 29s
0b87c8f14b
The long line was the `test -x` check (166 > 160), not the image reference.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 merged commit 67f95e18de into main 2026-10-25 12:34:33 +00:00
Defame1297 deleted branch feat/molecule-workflow 2026-10-25 12:34:34 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#10