ci: single runner, ubuntu-2204 only, fail-fast on first molecule failure
Use a single molecule test job (no matrix) on ubuntu-2204 only. This stops the workflow immediately when the first scenario fails instead of wasting time running 3 parallel runners that all fail for the same reason. Multi-platform will be restored once the base scenarios pass. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
312b8241df
commit
a57a5c328c
+9
-25
@@ -29,42 +29,26 @@ jobs:
|
||||
molecule-tests:
|
||||
needs: quality
|
||||
runs-on: docker
|
||||
strategy:
|
||||
fail-fast: true
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
runner-index: [0, 1, 2]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
run: make setup
|
||||
- name: Discover assigned test pairs
|
||||
- name: Run all molecule tests
|
||||
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 -e
|
||||
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 pair in $TEST_PAIRS; do
|
||||
IFS='|' read -r scenario platform_name platform_image platform_command <<< "$pair"
|
||||
export MOLECULE_PLATFORM_NAME="$platform_name"
|
||||
export MOLECULE_PLATFORM_IMAGE="$platform_image"
|
||||
if [ -n "$platform_command" ]; then
|
||||
export MOLECULE_PLATFORM_COMMAND="$platform_command"
|
||||
else
|
||||
unset MOLECULE_PLATFORM_COMMAND
|
||||
fi
|
||||
echo "::group::Molecule: $scenario on $platform_name"
|
||||
if [ "$scenario" = "default" ]; then
|
||||
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 "$scenario"
|
||||
ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true molecule test -s "$s"
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user