ci(molecule): run scenarios in four lanes and drop molecule's trailing destroy #303
No files matched your search
@@ -92,10 +92,11 @@ issue.
|
||||
raises the ansible-core floor must be behaviour-tested on the new core before it automerges.
|
||||
*Held:* aspirational until #225 runs Molecule from the `ci` image with the pin comparison
|
||||
against `/opt/ci-pins.sha256`; today it runs from the runner's own venv.
|
||||
- **Every scenario sets `scenario.test_sequence` to molecule's default minus the leading
|
||||
`destroy`;** copy it into a new scenario. *Why:* 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. *Held:* review.
|
||||
- **Every scenario sets `scenario.test_sequence` to molecule's default minus both `destroy`
|
||||
steps, and names its platforms literally in its `molecule.yml`;** copy it into a new scenario.
|
||||
*Why:* the workflow clears stale containers first and removes each scenario's containers by
|
||||
those names as soon as it ends, which skips the driver's destroy wait, and the molecule state
|
||||
lives in the job's own `ANSIBLE_HOME`, so a killed run leaves none behind. *Held:* review.
|
||||
- **Scenarios live in `roles/*/molecule/*/` and `extensions/molecule/*/`.** A role scenario that
|
||||
must pass on Ubuntu 24.04 and 26.04 takes `image: ${MOLECULE_IMAGE}` or
|
||||
`${MOLECULE_IMAGE_2604}` per platform; the image-smoke scenarios are described in
|
||||
|
||||
@@ -128,9 +128,11 @@ jobs:
|
||||
|
||||
# A pull request runs only the scenarios of the roles it changes (scripts/select_molecule_scenarios.py
|
||||
# explains the rules); a push to main and a manual dispatch run all of them.
|
||||
# molecule test destroys its instance on success and on failure; a cancelled run is killed
|
||||
# before it can, so the step first removes what such a run left, since the next run may not
|
||||
# select the same scenarios.
|
||||
# The scenarios leave out molecule's destroy (see their test_sequence): the step removes each
|
||||
# scenario's containers itself, by the platform names in its molecule.yml, as soon as it ends.
|
||||
# That skips the driver's destroy playbook: its deletion wait is about 5.6 s per scenario (about
|
||||
# 84 s over 15), and the whole destroy phase measured about 103 s a full run. A cancelled run
|
||||
# is killed before it can, so the step first removes what one left.
|
||||
- name: Run the scenarios
|
||||
working-directory: ac/ansible_collections/mortis/kamino
|
||||
env:
|
||||
@@ -169,6 +171,17 @@ jobs:
|
||||
echo "::notice::no base copy of $sel; running this checkout's copy"
|
||||
fi
|
||||
selected="$(python3 -I "$sel" "$BASE_REF")" || exit 1
|
||||
# Removes the containers of the scenario in directory $1 by its platform names (literal in
|
||||
# molecule.yml), whether or not they exist; a failure fails the step.
|
||||
remove_instances() {
|
||||
local names ids
|
||||
local py='import sys, yaml; print(*(p["name"] for p in yaml.safe_load(open(sys.argv[1]))["platforms"]))'
|
||||
names="$("$MOLECULE_VENV/bin/python3" -I -c "$py" "$1/molecule.yml")" && [ -n "$names" ] || return 1
|
||||
# shellcheck disable=SC2046,SC2086 # names and ids are one word each
|
||||
ids="$(docker ps -aq $(printf -- '--filter name=^/%s$ ' $names))" || return 1
|
||||
# shellcheck disable=SC2086
|
||||
[ -z "$ids" ] || docker rm -f $ids >/dev/null
|
||||
}
|
||||
failed=""
|
||||
ran=0
|
||||
while IFS= read -r dir; do
|
||||
@@ -188,6 +201,7 @@ jobs:
|
||||
(cd "roles/$role" && molecule test -s "$name" </dev/null) || failed="$failed $label"
|
||||
;;
|
||||
esac
|
||||
remove_instances "$dir" || failed="$failed $label(removal)"
|
||||
ran=$((ran + 1))
|
||||
echo "::endgroup::"
|
||||
done <<< "$selected"
|
||||
|
||||
@@ -26,10 +26,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -41,4 +40,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -26,10 +26,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -41,4 +40,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -26,10 +26,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -40,4 +39,3 @@ scenario:
|
||||
- check
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -26,10 +26,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -41,4 +40,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -27,10 +27,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -42,4 +41,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -25,10 +25,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -40,4 +39,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -36,10 +36,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -51,4 +50,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -44,10 +44,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -59,4 +58,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -25,10 +25,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -40,4 +39,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -26,10 +26,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -41,4 +40,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -32,10 +32,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -47,4 +46,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -25,10 +25,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -40,4 +39,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -46,10 +46,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -61,4 +60,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -25,10 +25,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -40,4 +39,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -33,10 +33,9 @@ provisioner:
|
||||
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.
|
||||
# molecule's default sequence minus both destroys: the workflow removes the container before the
|
||||
# run and as soon as this scenario ends; molecule's destroy only adds the driver's poll wait.
|
||||
# After a local run, run `molecule destroy` yourself.
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
@@ -48,4 +47,3 @@ scenario:
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
Reference in new issue
Block a user