From 792b3414d3ca3c533222245ceadb1964f033d1b2 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 14 Nov 2026 11:06:18 +0000 Subject: [PATCH] ci(molecule): drop the leading destroy from every scenario's test sequence The first destroy runs against a container that is not there and only waits out the Docker driver's fixed 5 s poll, about 6 s per scenario and 42 s per full run. The run step already removes what a killed run left, and molecule's state file lives under the job's own ANSIBLE_HOME (Runtime(isolated=False)), which is deleted with the checkout, so a cancelled run cannot make the next one skip create or prepare. The rest of the sequence is molecule's default. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG --- CLAUDE.md | 3 +++ .../molecule/image-smoke-2604/molecule.yml | 17 +++++++++++++++++ extensions/molecule/image-smoke/molecule.yml | 17 +++++++++++++++++ roles/docker/molecule/default/molecule.yml | 17 +++++++++++++++++ roles/fail2ban/molecule/default/molecule.yml | 17 +++++++++++++++++ .../molecule/default/molecule.yml | 17 +++++++++++++++++ .../molecule/default/molecule.yml | 17 +++++++++++++++++ .../molecule/default/molecule.yml | 17 +++++++++++++++++ 8 files changed, 122 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 275869f..362fca5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -67,6 +67,9 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily. is added to IGNORED, which is right only when no scenario reads it. A new commit cancels the pull request's running Molecule run, and the step first removes containers a cancelled run left; two runs never overlap because the runner has a single slot, so raising its capacity needs a lock or a shared concurrency group. +- Every scenario sets `scenario.test_sequence` to molecule's default minus the leading `destroy` (the workflow + clears stale containers first, and the molecule state lives in the job's own `ANSIBLE_HOME`, so a killed run leaves + none behind); copy it into a new scenario. - Molecule discovers `extensions/molecule/*/` and `roles/*/molecule/*/`. The `image-smoke` and `image-smoke-2604` scenarios test the molecule images themselves (24.04 and 26.04); a role scenario that must pass on both takes `image: ${MOLECULE_IMAGE}` or `${MOLECULE_IMAGE_2604}` per platform. diff --git a/extensions/molecule/image-smoke-2604/molecule.yml b/extensions/molecule/image-smoke-2604/molecule.yml index e2d5479..00db4cd 100644 --- a/extensions/molecule/image-smoke-2604/molecule.yml +++ b/extensions/molecule/image-smoke-2604/molecule.yml @@ -25,3 +25,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/extensions/molecule/image-smoke/molecule.yml b/extensions/molecule/image-smoke/molecule.yml index 94e7c07..ff89ab1 100644 --- a/extensions/molecule/image-smoke/molecule.yml +++ b/extensions/molecule/image-smoke/molecule.yml @@ -25,3 +25,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/roles/docker/molecule/default/molecule.yml b/roles/docker/molecule/default/molecule.yml index bc10d73..ecc4f9b 100644 --- a/roles/docker/molecule/default/molecule.yml +++ b/roles/docker/molecule/default/molecule.yml @@ -26,3 +26,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/roles/fail2ban/molecule/default/molecule.yml b/roles/fail2ban/molecule/default/molecule.yml index 453236e..44d84b3 100644 --- a/roles/fail2ban/molecule/default/molecule.yml +++ b/roles/fail2ban/molecule/default/molecule.yml @@ -24,3 +24,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/roles/network_interfaces/molecule/default/molecule.yml b/roles/network_interfaces/molecule/default/molecule.yml index e8380d5..4e79c56 100644 --- a/roles/network_interfaces/molecule/default/molecule.yml +++ b/roles/network_interfaces/molecule/default/molecule.yml @@ -24,3 +24,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/roles/system_baseline/molecule/default/molecule.yml b/roles/system_baseline/molecule/default/molecule.yml index f67f633..38d5d54 100644 --- a/roles/system_baseline/molecule/default/molecule.yml +++ b/roles/system_baseline/molecule/default/molecule.yml @@ -31,3 +31,20 @@ provisioner: skip-tags: molecule-notest,notest,sysctl,secure_tmp,update,timezone verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy diff --git a/roles/systemd_hardening/molecule/default/molecule.yml b/roles/systemd_hardening/molecule/default/molecule.yml index 7b5f79b..2794fc6 100644 --- a/roles/systemd_hardening/molecule/default/molecule.yml +++ b/roles/systemd_hardening/molecule/default/molecule.yml @@ -24,3 +24,20 @@ provisioner: name: ansible verifier: name: ansible +scenario: + # molecule's default sequence minus its first destroy: the workflow removes what a killed run + # left before any scenario starts, so that destroy only waits out the + # driver's 5 s poll on a container that is not there. After an aborted local run, run + # `molecule destroy` yourself. + test_sequence: + - dependency + - cleanup + - syntax + - create + - prepare + - converge + - idempotence + - side_effect + - verify + - cleanup + - destroy