From f105fd9a95581ecf088837b861ae6eb5adcd30f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Inderm=C3=BChle?= Date: Thu, 11 Apr 2024 10:46:43 +0200 Subject: [PATCH] Add tests for Ansible core 2.17 (devel is 2.18 today) and bump tests dependencies (#623) * Add tests for Ansible core 2.17 (devel is 2.18 today) * Drop tests for Ansible core 2.14 and add 2.17 * Cut duplicate exclude * Add back python 3.8 and 3.9 for stable2.15 * Bump action to prevent deprecation warnings * Cut python 3.9 for devel in roles tests * Attempt to fix GHA line folding * fix typo * Bump ubuntu Latest ansible-test doesn't work with old ubuntu. See here for more info: https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml#L83-L91 * fix docker_image var assignation * fix yamllint false positive * Attempt to fix docker_image_multiline assignation * Fix empty var due to scope of each command * Attempt to fix docker_image assignation * fix error "vars should be dict" * Document URL of the repository for the action ansible-test-gh-action * Disable role tests * Document ansible-core version tested * Cut ansible-core 2.14 from testing documentation --- .github/workflows/ansible-test-plugins.yml | 48 +++++++------------ ...t-roles.yml => ansible-test-roles.yml.off} | 26 ++++++---- .github/workflows/build-docker-image.yml | 2 +- ...ker-image-mariadb-py310-mysqlclient211.yml | 2 +- .../docker-image-mariadb-py310-pymysql102.yml | 2 +- ...cker-image-mariadb-py38-mysqlclient201.yml | 2 +- .../docker-image-mariadb-py38-pymysql093.yml | 2 +- ...cker-image-mariadb-py39-mysqlclient203.yml | 2 +- .../docker-image-mariadb-py39-pymysql093.yml | 2 +- .../docker-image-my57-py38-mysqlclient201.yml | 2 +- .../docker-image-my57-py38-pymysql0711.yml | 2 +- .../docker-image-my57-py38-pymysql093.yml | 2 +- ...ocker-image-mysql-py310-mysqlclient211.yml | 2 +- .../docker-image-mysql-py310-pymysql102.yml | 2 +- ...docker-image-mysql-py38-mysqlclient201.yml | 2 +- .../docker-image-mysql-py38-pymysql093.yml | 2 +- ...docker-image-mysql-py39-mysqlclient203.yml | 2 +- .../docker-image-mysql-py39-pymysql093.yml | 2 +- README.md | 2 +- TESTING.md | 4 +- .../tasks/test_tls_requirements.yml | 10 ++-- 21 files changed, 59 insertions(+), 63 deletions(-) rename .github/workflows/{ansible-test-roles.yml => ansible-test-roles.yml.off} (77%) diff --git a/.github/workflows/ansible-test-plugins.yml b/.github/workflows/ansible-test-plugins.yml index 78644bb..77da49e 100644 --- a/.github/workflows/ansible-test-plugins.yml +++ b/.github/workflows/ansible-test-plugins.yml @@ -1,6 +1,6 @@ --- name: Plugins CI -on: +on: # yamllint disable-line rule:truthy push: paths: - 'plugins/**' @@ -18,15 +18,16 @@ on: jobs: sanity: name: "Sanity (Ansible: ${{ matrix.ansible }})" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: ansible: - - stable-2.14 - stable-2.15 - stable-2.16 + - stable-2.17 - devel steps: + # https://github.com/ansible-community/ansible-test-gh-action - name: Perform sanity testing uses: ansible-community/ansible-test-gh-action@release/v1 with: @@ -36,14 +37,14 @@ jobs: integration: name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, DB: ${{ matrix.db_engine_name }} ${{ matrix.db_engine_version }}, connector: ${{ matrix.connector_name }} ${{ matrix.connector_version }})" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: ansible: - - stable-2.14 - stable-2.15 - stable-2.16 + - stable-2.17 - devel db_engine_name: - mysql @@ -111,9 +112,6 @@ jobs: - db_engine_version: 5.7.40 python: '3.10' - - db_engine_version: 5.7.40 - ansible: stable-2.14 - - db_engine_version: 5.7.40 ansible: stable-2.15 @@ -126,9 +124,6 @@ jobs: - db_engine_version: 8.0.31 python: '3.8' - - db_engine_version: 8.0.31 - python: '3.8' - - db_engine_version: 10.4.27 python: '3.10' @@ -174,23 +169,20 @@ jobs: - python: '3.10' connector_version: 2.0.3 - - python: '3.8' - ansible: stable-2.14 - - - python: '3.8' - ansible: stable-2.15 - - python: '3.8' ansible: stable-2.16 + - python: '3.8' + ansible: stable-2.17 + - python: '3.8' ansible: devel - python: '3.9' - ansible: stable-2.15 + ansible: stable-2.16 - python: '3.9' - ansible: stable-2.16 + ansible: stable-2.17 - python: '3.9' ansible: devel @@ -284,16 +276,12 @@ jobs: fi - name: Set docker_image - run: > - docker_image_multiline=(" - ghcr.io/ansible-collections/community.mysql\ + run: |- + echo "docker_image=ghcr.io/ansible-collections/community.mysql\ /test-container-${{ env.db_client }}\ -py${{ env.python_version_flat }}\ -${{ matrix.connector_name }}${{ env.connector_version_flat }}\ - :latest") - - echo "docker_image=$(printf '%s' $docker_image_multiline)" - >> $GITHUB_ENV + :latest" >> $GITHUB_ENV - name: >- Perform integration testing against @@ -332,7 +320,7 @@ jobs: testing-type: integration units: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 name: Units (Ⓐ${{ matrix.ansible }}) strategy: # As soon as the first unit test fails, @@ -340,20 +328,20 @@ jobs: fail-fast: true matrix: ansible: - - stable-2.14 - stable-2.15 - stable-2.16 + - stable-2.17 - devel python: - 3.8 - 3.9 exclude: - - python: '3.8' - ansible: stable-2.14 - python: '3.8' ansible: stable-2.15 - python: '3.8' ansible: stable-2.16 + - python: '3.8' + ansible: stable-2.17 - python: '3.8' ansible: devel diff --git a/.github/workflows/ansible-test-roles.yml b/.github/workflows/ansible-test-roles.yml.off similarity index 77% rename from .github/workflows/ansible-test-roles.yml rename to .github/workflows/ansible-test-roles.yml.off index da8a805..a11d982 100644 --- a/.github/workflows/ansible-test-roles.yml +++ b/.github/workflows/ansible-test-roles.yml.off @@ -1,6 +1,6 @@ --- name: Roles CI -on: +on: # yamllint disable-line rule:truthy push: paths: - 'roles/**' @@ -15,7 +15,7 @@ on: jobs: molecule: name: "Molecule (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.mysql }})" - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 @@ -24,26 +24,36 @@ jobs: mysql: - 2.0.12 ansible: - - stable-2.13 - - stable-2.14 - stable-2.15 + - stable-2.16 + - stable-2.17 - devel python: - - 3.8 - - 3.9 + - '3.8' + - '3.9' + - '3.10' exclude: - python: 3.8 + ansible: stable-2.17 + + - python: 3.9 + ansible: stable-2.17 + + - python: 3.8 + ansible: devel + + - python: 3.9 ansible: devel steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ansible_collections/community/mysql - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index fa10268..0edd5ee 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -1,7 +1,7 @@ --- name: Build Docker Image for ansible-test -on: +on: # yamllint disable-line rule:truthy workflow_call: inputs: registry: diff --git a/.github/workflows/docker-image-mariadb-py310-mysqlclient211.yml b/.github/workflows/docker-image-mariadb-py310-mysqlclient211.yml index be252b7..77286e6 100644 --- a/.github/workflows/docker-image-mariadb-py310-mysqlclient211.yml +++ b/.github/workflows/docker-image-mariadb-py310-mysqlclient211.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py310-mysqlclient211 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py310-mysqlclient211/**' diff --git a/.github/workflows/docker-image-mariadb-py310-pymysql102.yml b/.github/workflows/docker-image-mariadb-py310-pymysql102.yml index 90fec0e..c7cdfd4 100644 --- a/.github/workflows/docker-image-mariadb-py310-pymysql102.yml +++ b/.github/workflows/docker-image-mariadb-py310-pymysql102.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py310-pymysql102 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py310-pymysql102/**' diff --git a/.github/workflows/docker-image-mariadb-py38-mysqlclient201.yml b/.github/workflows/docker-image-mariadb-py38-mysqlclient201.yml index c9c04f4..b5b9bb3 100644 --- a/.github/workflows/docker-image-mariadb-py38-mysqlclient201.yml +++ b/.github/workflows/docker-image-mariadb-py38-mysqlclient201.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py38-mysqlclient201 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py38-mysqlclient201/**' diff --git a/.github/workflows/docker-image-mariadb-py38-pymysql093.yml b/.github/workflows/docker-image-mariadb-py38-pymysql093.yml index 92d0a74..ae6df2e 100644 --- a/.github/workflows/docker-image-mariadb-py38-pymysql093.yml +++ b/.github/workflows/docker-image-mariadb-py38-pymysql093.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py38-pymysql093 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py38-pymysql093/**' diff --git a/.github/workflows/docker-image-mariadb-py39-mysqlclient203.yml b/.github/workflows/docker-image-mariadb-py39-mysqlclient203.yml index afad5af..4efeef1 100644 --- a/.github/workflows/docker-image-mariadb-py39-mysqlclient203.yml +++ b/.github/workflows/docker-image-mariadb-py39-mysqlclient203.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py39-mysqlclient203 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py39-mysqlclient203/**' diff --git a/.github/workflows/docker-image-mariadb-py39-pymysql093.yml b/.github/workflows/docker-image-mariadb-py39-pymysql093.yml index 1aa5a04..a3205fb 100644 --- a/.github/workflows/docker-image-mariadb-py39-pymysql093.yml +++ b/.github/workflows/docker-image-mariadb-py39-pymysql093.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mariadb-py39-pymysql093 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mariadb-py39-pymysql093/**' diff --git a/.github/workflows/docker-image-my57-py38-mysqlclient201.yml b/.github/workflows/docker-image-my57-py38-mysqlclient201.yml index 7aaf7e3..b256a47 100644 --- a/.github/workflows/docker-image-my57-py38-mysqlclient201.yml +++ b/.github/workflows/docker-image-my57-py38-mysqlclient201.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI my57-py38-mysqlclient201 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/my57-py38-mysqlclient201/**' diff --git a/.github/workflows/docker-image-my57-py38-pymysql0711.yml b/.github/workflows/docker-image-my57-py38-pymysql0711.yml index 0bc2a9d..0064729 100644 --- a/.github/workflows/docker-image-my57-py38-pymysql0711.yml +++ b/.github/workflows/docker-image-my57-py38-pymysql0711.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI my57-py38-pymysql0711 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/my57-py38-pymysql0711/**' diff --git a/.github/workflows/docker-image-my57-py38-pymysql093.yml b/.github/workflows/docker-image-my57-py38-pymysql093.yml index 462324b..58c7fed 100644 --- a/.github/workflows/docker-image-my57-py38-pymysql093.yml +++ b/.github/workflows/docker-image-my57-py38-pymysql093.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI my57-py38-pymysql093 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/my57-py38-pymysql093/**' diff --git a/.github/workflows/docker-image-mysql-py310-mysqlclient211.yml b/.github/workflows/docker-image-mysql-py310-mysqlclient211.yml index 307aea7..dcb846f 100644 --- a/.github/workflows/docker-image-mysql-py310-mysqlclient211.yml +++ b/.github/workflows/docker-image-mysql-py310-mysqlclient211.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py310-mysqlclient211 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py310-mysqlclient211/**' diff --git a/.github/workflows/docker-image-mysql-py310-pymysql102.yml b/.github/workflows/docker-image-mysql-py310-pymysql102.yml index 6f7bf3f..815b923 100644 --- a/.github/workflows/docker-image-mysql-py310-pymysql102.yml +++ b/.github/workflows/docker-image-mysql-py310-pymysql102.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py310-pymysql102 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py310-pymysql102/**' diff --git a/.github/workflows/docker-image-mysql-py38-mysqlclient201.yml b/.github/workflows/docker-image-mysql-py38-mysqlclient201.yml index e0da5df..93359a4 100644 --- a/.github/workflows/docker-image-mysql-py38-mysqlclient201.yml +++ b/.github/workflows/docker-image-mysql-py38-mysqlclient201.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py38-mysqlclient201 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py38-mysqlclient201/**' diff --git a/.github/workflows/docker-image-mysql-py38-pymysql093.yml b/.github/workflows/docker-image-mysql-py38-pymysql093.yml index 3cc1e0a..ac572ea 100644 --- a/.github/workflows/docker-image-mysql-py38-pymysql093.yml +++ b/.github/workflows/docker-image-mysql-py38-pymysql093.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py38-pymysql093 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py38-pymysql093/**' diff --git a/.github/workflows/docker-image-mysql-py39-mysqlclient203.yml b/.github/workflows/docker-image-mysql-py39-mysqlclient203.yml index 0a3a256..b314e57 100644 --- a/.github/workflows/docker-image-mysql-py39-mysqlclient203.yml +++ b/.github/workflows/docker-image-mysql-py39-mysqlclient203.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py39-mysqlclient203 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py39-mysqlclient203/**' diff --git a/.github/workflows/docker-image-mysql-py39-pymysql093.yml b/.github/workflows/docker-image-mysql-py39-pymysql093.yml index b974420..55962fb 100644 --- a/.github/workflows/docker-image-mysql-py39-pymysql093.yml +++ b/.github/workflows/docker-image-mysql-py39-pymysql093.yml @@ -1,7 +1,7 @@ --- name: Docker Image CI mysql-py39-pymysql093 -on: +on: # yamllint disable-line rule:truthy push: paths: - 'test-containers/mysql-py39-pymysql093/*' diff --git a/README.md b/README.md index 0e0704e..9853569 100644 --- a/README.md +++ b/README.md @@ -99,9 +99,9 @@ Here is the table for the support timeline: ### ansible-core -- stable-2.14 - stable-2.15 - stable-2.16 +- stable-2.17 - current development version ### Databases diff --git a/TESTING.md b/TESTING.md index 9e0840a..f31db4a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -49,11 +49,9 @@ The Makefile accept the following options - `ansible` - Mandatory: true - Choices: - - "stable-2.12" - - "stable-2.13" - - "stable-2.14" - "stable-2.15" - "stable-2.16" + - "stable-2.17" - "devel" - Description: Version of ansible to install in a venv to run ansible-test diff --git a/tests/integration/targets/test_mysql_user/tasks/test_tls_requirements.yml b/tests/integration/targets/test_mysql_user/tasks/test_tls_requirements.yml index d8c2935..e7c25ce 100644 --- a/tests/integration/targets/test_mysql_user/tasks/test_tls_requirements.yml +++ b/tests/integration/targets/test_mysql_user/tasks/test_tls_requirements.yml @@ -76,14 +76,14 @@ that: - "'SSL' in reqs" vars: - - reqs: "{{((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_1) | first).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}" + reqs: "{{ ((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_1) | first).stdout.split('REQUIRE')[1].split(separator)[0].strip() }}" - name: Tls reqs | Assert user2 TLS requirements assert: that: - "'X509' in reqs" vars: - - reqs: "{{((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_2) | first).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}" + reqs: "{{ ((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_2) | first).stdout.split('REQUIRE')[1].split(separator)[0].strip() }}" - name: Tls reqs | Assert user3 TLS requirements assert: @@ -92,7 +92,7 @@ - "'/CN=org/O=MyDom, Inc./C=US/ST=Oregon/L=Portland' in (reqs | select('contains', 'ISSUER') | first)" - "'ECDHE-ECDSA-AES256-SHA384' in (reqs | select('contains', 'CIPHER') | first)" vars: - - reqs: "{{((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_3) | first).stdout.split('REQUIRE')[1].split(separator)[0].replace(\"' \", \"':\").split(\":\")}}" + reqs: "{{ ((old_result.results[0] is skipped | ternary(new_result, old_result)).results | selectattr('item', 'contains', user_name_3) | first).stdout.split('REQUIRE')[1].split(separator)[0].replace(\"' \", \"':\").split(\":\") }}" # CentOS 6 uses an older version of jinja that does not provide the selectattr filter. when: ansible_distribution != 'CentOS' or ansible_distribution_major_version != '6' @@ -129,7 +129,7 @@ assert: that: "'SSL' in reqs" vars: - - reqs: "{{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}" + reqs: "{{ (old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() }}" - name: Tls reqs | Modify user with TLS requirements state=present (expect changed=true) mysql_user: @@ -157,7 +157,7 @@ assert: that: "'X509' in reqs" vars: - - reqs: "{{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip()}}" + reqs: "{{ (old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() }}" - name: Tls reqs | Remove TLS requirements from user (expect changed=true) mysql_user: