feat: parallel molecule runner with kill-on-first-failure
CI / quality (pull_request) Successful in 1m2s
CI / molecule-tests (1) (pull_request) Failing after 55s
CI / molecule-tests (0) (pull_request) Failing after 1m11s
CI / molecule-tests (2) (pull_request) Failing after 1m21s

Added scripts/run_molecule_parallel.py to run a runner's assigned
(scenario, platform) pairs in parallel. If any subprocess fails, the
remaining ones are terminated with SIGTERM/SIGKILL and the runner
exits immediately. This gives fast feedback without continuing to run
tests that are guaranteed to fail for the same reason.

CI workflow now calls this script per matrix runner. Added fail-fast and
max-parallel for best-effort cancellation across runners.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Emil Simeonov
2026-06-20 23:19:25 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent a57a5c328c
commit 69b96e4785
3 changed files with 293 additions and 14 deletions
+12 -14
View File
@@ -29,26 +29,24 @@ jobs:
molecule-tests:
needs: quality
runs-on: docker
strategy:
fail-fast: true
matrix:
runner-index: [0, 1, 2]
steps:
- uses: actions/checkout@v4
- name: Set up environment
run: make setup
- name: Run all molecule tests
- name: Discover assigned test pairs
run: |
. .venv/bin/activate
PAIRS=$(python3 scripts/distribute_molecule.py --runner-index ${{ matrix.runner-index }} --max-runners 3)
echo "Assigned pairs: $PAIRS"
echo "TEST_PAIRS=$PAIRS" >> $GITHUB_ENV
- name: Run molecule tests
run: |
set -euo pipefail
. .venv/bin/activate
export DOCKER_HOST="unix:///run/user/$(id -u)/docker.sock"
export ANSIBLE_INJECT_INVOCATION=1
cd ansible/roles/gitea-runner
for s in default multi-instance lifecycle template-content deregister update; do
export MOLECULE_PLATFORM_NAME="ubuntu-2204"
export MOLECULE_PLATFORM_IMAGE="geerlingguy/docker-ubuntu2204-ansible:latest"
export MOLECULE_PLATFORM_COMMAND="/lib/systemd/systemd"
echo "::group::Molecule: $s on ubuntu-2204"
if [ "$s" = "default" ]; then
ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true molecule test
else
ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true molecule test -s "$s"
fi
echo "::endgroup::"
done
python3 scripts/run_molecule_parallel.py $TEST_PAIRS