From 5ea2fe65b02e24c7cf3567f511ab544c8eb96ed9 Mon Sep 17 00:00:00 2001 From: Lila Yasin Date: Thu, 6 Nov 2025 09:22:44 -0500 Subject: [PATCH] Fix failing Collection CI Checks (#16157) * Fix CI: Use Python 3.13 for ansible-test compatibility ansible-test only supports Python 3.11, 3.12, and 3.13. Changed collection-integration jobs from '3.x' to '3.13' to avoid using Python 3.14 which is not supported. * Fix ansible-test Python version for CI integration tests ansible-test only supports Python 3.11, 3.12, and 3.13. Added ANSIBLE_TEST_PYTHON_VERSION variable to explicitly pass --python 3.13 flag to ansible-test integration command. This prevents ansible-test from auto-detecting and using Python 3.14.0, which is not supported. * Fix CI: Execute ansible-test with Python 3.13 to avoid unsupported Python 3.14 * Fix CI: Use Python 3.13 across all jobs to avoid Python 3.14 compatibility issues * Fix CI: Use 'python' and 'ansible.test' module for Python 3.13 compatibility * Fix CI: Use 'python' instead of 'python3' for Python 3.13 compatibility * Fix CI: Ensure ansible-test uses Python 3.13 environment explicitly * Fix: Remove silent failure check for ansible-core in test suite * Fix CI: Export PYTHONPATH to make awxkit available to ansible-test * Fix CI: Use 'python' in run_awx_devel to maintain Python 3.13 environment * Fix CI: Remove setup-python from awx_devel_image that was resetting Python 3.13 to 3.14 --- .github/actions/awx_devel_image/action.yml | 2 -- .github/actions/run_awx_devel/action.yml | 2 +- .github/workflows/ci.yml | 37 ++++++++++++++-------- Makefile | 6 ++-- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/actions/awx_devel_image/action.yml b/.github/actions/awx_devel_image/action.yml index 354279f2c3..f786ddba0a 100644 --- a/.github/actions/awx_devel_image/action.yml +++ b/.github/actions/awx_devel_image/action.yml @@ -11,8 +11,6 @@ inputs: runs: using: composite steps: - - uses: ./.github/actions/setup-python - - name: Set lower case owner name shell: bash run: echo "OWNER_LC=${OWNER,,}" >> $GITHUB_ENV diff --git a/.github/actions/run_awx_devel/action.yml b/.github/actions/run_awx_devel/action.yml index 723e247783..72b50dca50 100644 --- a/.github/actions/run_awx_devel/action.yml +++ b/.github/actions/run_awx_devel/action.yml @@ -36,7 +36,7 @@ runs: - name: Upgrade ansible-core shell: bash - run: python3 -m pip install --upgrade ansible-core + run: python -m pip install --upgrade ansible-core - name: Install system deps shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 608a9f75d3..e59cfc30c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,7 +145,7 @@ jobs: - uses: ./.github/actions/setup-python with: - python-version: '3.x' + python-version: '3.13' - uses: ./.github/actions/run_awx_devel id: awx @@ -188,11 +188,11 @@ jobs: - name: Setup python, referencing action at awx relative path uses: ./awx/.github/actions/setup-python with: - python-version: '3.x' + python-version: '3.13' - name: Install playbook dependencies run: | - python3 -m pip install docker + python -m pip install docker - name: Build AWX image working-directory: awx @@ -206,8 +206,8 @@ jobs: - name: Run test deployment with awx-operator working-directory: awx-operator run: | - python3 -m pip install -r molecule/requirements.txt - python3 -m pip install PyYAML # for awx/tools/scripts/rewrite-awx-operator-requirements.py + python -m pip install -r molecule/requirements.txt + python -m pip install PyYAML # for awx/tools/scripts/rewrite-awx-operator-requirements.py $(realpath ../awx/tools/scripts/rewrite-awx-operator-requirements.py) molecule/requirements.yml $(realpath ../awx) ansible-galaxy collection install -r molecule/requirements.yml sudo rm -f $(which kustomize) @@ -294,7 +294,11 @@ jobs: - uses: ./.github/actions/setup-python with: - python-version: '3.x' + python-version: '3.13' + + - name: Remove system ansible to avoid conflicts + run: | + python -m pip uninstall -y ansible ansible-core || true - uses: ./.github/actions/run_awx_devel id: awx @@ -305,8 +309,9 @@ jobs: - name: Install dependencies for running tests run: | - python3 -m pip install -e ./awxkit/ - python3 -m pip install -r awx_collection/requirements.txt + python -m pip install -e ./awxkit/ + python -m pip install -r awx_collection/requirements.txt + hash -r # Rehash to pick up newly installed scripts - name: Run integration tests id: make-run @@ -318,6 +323,7 @@ jobs: echo 'password = password' >> ~/.tower_cli.cfg echo 'verify_ssl = false' >> ~/.tower_cli.cfg TARGETS="$(ls awx_collection/tests/integration/targets | grep '${{ matrix.target-regex.regex }}' | tr '\n' ' ')" + export PYTHONPATH="$(python -c 'import site; print(":".join(site.getsitepackages()))')${PYTHONPATH:+:$PYTHONPATH}" make COLLECTION_VERSION=100.100.100-git COLLECTION_TEST_TARGET="--requirements $TARGETS" test_collection_integration env: ANSIBLE_TEST_PREFER_PODMAN: 1 @@ -372,10 +378,14 @@ jobs: - uses: ./.github/actions/setup-python with: - python-version: '3.x' + python-version: '3.13' + + - name: Remove system ansible to avoid conflicts + run: | + python -m pip uninstall -y ansible ansible-core || true - name: Upgrade ansible-core - run: python3 -m pip install --upgrade ansible-core + run: python -m pip install --upgrade ansible-core - name: Download coverage artifacts uses: actions/download-artifact@v4 @@ -390,11 +400,12 @@ jobs: mkdir -p ~/.ansible/collections/ansible_collections/awx/awx/tests/output/coverage cp -rv coverage/* ~/.ansible/collections/ansible_collections/awx/awx/tests/output/coverage/ cd ~/.ansible/collections/ansible_collections/awx/awx - ansible-test coverage combine --requirements - ansible-test coverage html + hash -r # Rehash to pick up newly installed scripts + PATH="$(python -c 'import sys; import os; print(os.path.dirname(sys.executable))'):$PATH" ansible-test coverage combine --requirements + PATH="$(python -c 'import sys; import os; print(os.path.dirname(sys.executable))'):$PATH" ansible-test coverage html echo '## AWX Collection Integration Coverage' >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - ansible-test coverage report >> $GITHUB_STEP_SUMMARY + PATH="$(python -c 'import sys; import os; print(os.path.dirname(sys.executable))'):$PATH" ansible-test coverage report >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY echo >> $GITHUB_STEP_SUMMARY echo '## AWX Collection Integration Coverage HTML' >> $GITHUB_STEP_SUMMARY diff --git a/Makefile b/Makefile index 3bc3f0adc5..51c9af9d74 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ TEST_DIRS ?= awx/main/tests/unit awx/main/tests/functional awx/conf/tests PARALLEL_TESTS ?= -n auto # collection integration test directories (defaults to all) COLLECTION_TEST_TARGET ?= +# Python version for ansible-test (must be 3.11, 3.12, or 3.13) +ANSIBLE_TEST_PYTHON_VERSION ?= 3.13 # args for collection install COLLECTION_PACKAGE ?= awx COLLECTION_NAMESPACE ?= awx @@ -431,8 +433,8 @@ test_collection_sanity: test_collection_integration: install_collection cd $(COLLECTION_INSTALL) && \ - ansible-test integration --coverage -vvv $(COLLECTION_TEST_TARGET) && \ - ansible-test coverage xml --requirements --group-by command --group-by version + PATH="$$($(PYTHON) -c 'import sys; import os; print(os.path.dirname(sys.executable))'):$$PATH" ansible-test integration --python $(ANSIBLE_TEST_PYTHON_VERSION) --coverage -vvv $(COLLECTION_TEST_TARGET) && \ + PATH="$$($(PYTHON) -c 'import sys; import os; print(os.path.dirname(sys.executable))'):$$PATH" ansible-test coverage xml --requirements --group-by command --group-by version @if [ "${GITHUB_ACTIONS}" = "true" ]; \ then \ echo cov-report-files="$$(find "$(COLLECTION_INSTALL)/tests/output/reports/" -type f -name 'coverage=integration*.xml' -print0 | tr '\0' ',' | sed 's#,$$##')" >> "${GITHUB_OUTPUT}"; \