mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-04-28 00:56:27 +00:00
The cloud.common collection is incompatible with ansible-core >= 2.19.0.
With the current testing matrix using Python 3.12 and the ansible
milestone (currently 2.22), this incompatibility causes integration
tests to fail.
Instead of completely removing turbo mode from the testing matrix, this
commit adds ansible-core 2.18 to the matrix and excludes the combination
of the ansible milestone and turbo mode. The checkout and installation
of the cloud.common collection are now conditionally executed only when
turbo mode is enabled.
(cherry picked from commit 11f619b69e)
Co-authored-by: Yuriy Novostavskiy <yuriy@novostavskiy.kiev.ua>
164 lines
5.8 KiB
YAML
164 lines
5.8 KiB
YAML
name: Integration tests
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- labeled
|
|
- unlabeled
|
|
- synchronize
|
|
branches:
|
|
- main
|
|
- stable-*
|
|
|
|
jobs:
|
|
splitter:
|
|
env:
|
|
source_dir: "./source"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
test_targets: ${{ steps.splitter.outputs.test_targets }}
|
|
test_targets_json: ${{ steps.splitter.outputs.test_targets_json }}
|
|
test_jobs: ${{ steps.splitter.outputs.test_jobs }}
|
|
steps:
|
|
- name: Checkout the collection repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ${{ env.source_dir }}
|
|
fetch-depth: "0"
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: list changes for pull request
|
|
id: splitter
|
|
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main
|
|
with:
|
|
collections_to_test: ${{ env.source_dir }}
|
|
total_jobs: 8
|
|
|
|
- name: Display splitter output
|
|
run: |
|
|
echo "test_targets=${{ steps.splitter.outputs.test_targets }}"
|
|
echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}"
|
|
echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}"
|
|
shell: bash
|
|
integration:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
needs:
|
|
- splitter
|
|
if: ${{ needs.splitter.outputs.test_targets != '' }}
|
|
env:
|
|
source: "./source"
|
|
cloud_common: "./cloudcommon"
|
|
ansible_posix: "./ansible_posix"
|
|
community_general: "./community_general"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
ansible-version: ["2.18", "milestone"]
|
|
enable-turbo-mode: [true, false]
|
|
exclude:
|
|
- ansible-version: "milestone"
|
|
enable-turbo-mode: true
|
|
python-version:
|
|
- "3.12"
|
|
workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }}
|
|
name: "integration-py${{ matrix.python-version }}-${{ matrix.ansible-version }}-${{ matrix.workflow-id }}-enable_turbo=${{ matrix.enable-turbo-mode }}"
|
|
steps:
|
|
- name: Read target
|
|
id: read-targets
|
|
run: |
|
|
import json, os
|
|
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
|
|
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
|
|
shell: python
|
|
env:
|
|
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
|
|
WORKFLOW_ID: ${{ matrix.workflow-id }}
|
|
|
|
- name: Display ansible test targets
|
|
run: |
|
|
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
|
|
|
|
- name: Checkout kubernetes.core repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ${{ env.source }}
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# install ansible
|
|
- name: Install ansible-core (${{ matrix.ansible-version }})
|
|
run: >-
|
|
python3 -m pip install
|
|
https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz
|
|
--disable-pip-version-check
|
|
shell: bash
|
|
|
|
- name: Build and install collection
|
|
id: install-src
|
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
|
with:
|
|
install_python_dependencies: true
|
|
source_path: ${{ env.source }}
|
|
|
|
- name: checkout ansible-collections/cloud.common
|
|
if: ${{ matrix.enable-turbo-mode == true }}
|
|
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
|
|
with:
|
|
repository: ansible-collections/cloud.common
|
|
path: ${{ env.cloud_common }}
|
|
ref: main
|
|
|
|
- name: checkout ansible-collections/ansible.posix
|
|
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
|
|
with:
|
|
repository: ansible-collections/ansible.posix
|
|
path: ${{ env.ansible_posix }}
|
|
ref: main
|
|
|
|
- name: checkout ansible-collections/community.general
|
|
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
|
|
with:
|
|
repository: ansible-collections/community.general
|
|
path: ${{ env.community_general }}
|
|
ref: main
|
|
|
|
- name: install cloud.common collection
|
|
if: ${{ matrix.enable-turbo-mode == true }}
|
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
|
with:
|
|
install_python_dependencies: true
|
|
source_path: ${{ env.cloud_common }}
|
|
|
|
- name: install ansible.posix collection
|
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
|
with:
|
|
install_python_dependencies: true
|
|
source_path: ${{ env.ansible_posix }}
|
|
|
|
- name: install community.general collection
|
|
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
|
|
with:
|
|
install_python_dependencies: false
|
|
source_path: ${{ env.community_general }}
|
|
|
|
- name: create kubernetes cluster
|
|
uses: helm/kind-action@v1.8.0
|
|
with:
|
|
node_image: "kindest/node:v1.29.2"
|
|
|
|
- name: Run integration tests
|
|
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main
|
|
with:
|
|
collection_path: ${{ steps.install-src.outputs.collection_path }}
|
|
python_version: ${{ matrix.python-version }}
|
|
ansible_version: ${{ matrix.ansible-version }}
|
|
ansible_test_targets: ${{ steps.read-targets.outputs.ansible_test_targets }}
|
|
ansible_test_environment: |
|
|
ENABLE_TURBO_MODE=${{ matrix.enable-turbo-mode }}
|