Skip to content

Commit

Permalink
[CI] Add 2024 versions to tests (#660)
Browse files Browse the repository at this point in the history
* Enable mysql_native_password for MySQL 8.2+
* Fix connection to MySQL 8 since Ubuntu 20.04 update
* Cut mysqlclient form the documentation
* Cut tests for Python 3.12 not supported by ansible-test
* Upgrade integration controller to ubuntu2204 by removing python

ansible-test uses python 3.10 if we specify ubuntu2204. Thus we lose the
ability to chose specific version of python to test. But integrations
tests are optional for a collection. And we don't catch a issue with
Python that often (ever ? I don't recall seen one).

This allow us to test MySQL 8.4, so it's a win.

* Cut tests for EoL MariaDB 10.4
* Reduce number of test in the matrix
* Cut support for intermediate LTS
* Fix python command not found with ansible-devel and add the debug

This is puzzling me. Why when using ansible devel the python command
changes? I know ansible-test install python after starting ubuntu22.04
so the way python is install must changes.

* Disable retry-on-error

When reading log we tend to look at the bottom, but doing so we find
often a idempotent error that are nothing to do with the first error.
Disabling this can greatly speedup tests and makes logs more readable.

Plus, now GHA jumps automatically at the latest error message. So with
this modification, we will always jump to the latest real error message.

* Enhance jobs title readability

We can't expand the left column on GHA, so the shorter, the better.
Use Ⓐ instead of Ansible.
  • Loading branch information
laurent-indermuehle authored Jul 19, 2024
1 parent 83ed4af commit c503dc5
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 170 deletions.
230 changes: 120 additions & 110 deletions .github/workflows/ansible-test-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on: # yamllint disable-line rule:truthy

jobs:
sanity:
name: "Sanity (Ansible: ${{ matrix.ansible }})"
name: "Sanity (${{ matrix.ansible }})"
runs-on: ubuntu-22.04
strategy:
matrix:
Expand All @@ -35,8 +35,10 @@ jobs:
testing-type: sanity
pull-request-change-detection: true

# Use this to chose which version of Python vs Ansible to test:
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-control-node-python-support
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 }})"
name: "Integration (${{ matrix.ansible }}, DB: ${{ matrix.db_engine_name }} ${{ matrix.db_engine_version }}, connector: ${{ matrix.connector_name }} ${{ matrix.connector_version }})"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand All @@ -50,142 +52,117 @@ jobs:
- mysql
- mariadb
db_engine_version:
- 5.7.40
- 8.0.31
- 10.4.27
- 10.5.18
- 10.6.11
python:
- '3.8'
- '3.9'
- '3.10'
- '8.0.38'
- '8.4.1'
- '10.5.25'
- '10.11.8'
connector_name:
- pymysql
- mysqlclient
connector_version:
- 0.7.11
- 0.9.3
- 1.0.2
- 2.0.1
- 2.0.3
- 2.1.1
- '0.9.3'
- '1.0.2'
- '1.1.1'
- '2.0.1'
- '2.0.3'
- '2.1.1'

include:

# RHEL8 context
- connector_name: pymysql
connector_version: '0.10.1'
ansible: stable-2.16
db_engine_name: mariadb
db_engine_version: '10.11.8'

# RHEL9 context
# - connector_name: pymysql
# connector_version: '1.1.1'
# ansible: stable-2.17
# db_engine_name: mariadb
# db_engine_version: '10.11.8'
# This tests is already included in the matrix, no need repeating

exclude:
- db_engine_name: mysql
db_engine_version: 10.4.27

- db_engine_name: mysql
db_engine_version: 10.5.18
db_engine_version: '10.5.25'

- db_engine_name: mysql
db_engine_version: 10.6.11
db_engine_version: '10.11.8'

- db_engine_name: mariadb
db_engine_version: 5.7.40
db_engine_version: '8.0.38'

- db_engine_name: mariadb
db_engine_version: 8.0.31
db_engine_version: '8.4.1'

- connector_name: pymysql
connector_version: 2.0.1
connector_version: '2.0.1'

- connector_name: pymysql
connector_version: 2.0.3
connector_version: '2.0.3'

- connector_name: pymysql
connector_version: 2.1.1
connector_version: '2.1.1'

- connector_name: mysqlclient
connector_version: 0.7.11
connector_version: '0.9.3'

- connector_name: mysqlclient
connector_version: 0.9.3
connector_version: '1.0.2'

- connector_name: mysqlclient
connector_version: 1.0.2
connector_version: '1.1.1'

- db_engine_name: mariadb
connector_version: 0.7.11

- db_engine_version: 5.7.40
python: '3.9'

- db_engine_version: 5.7.40
python: '3.10'

- db_engine_version: 5.7.40
ansible: stable-2.15
- db_engine_version: '8.0.38'
ansible: stable-2.17

- db_engine_version: 5.7.40
ansible: stable-2.16
- db_engine_version: '10.5.25'
ansible: stable-2.17

- db_engine_version: 5.7.40
- db_engine_version: '8.0.38'
ansible: devel

- db_engine_version: 8.0.31
python: '3.8'

- db_engine_version: 10.4.27
python: '3.10'

- db_engine_version: 10.4.27
- db_engine_version: '10.5.25'
ansible: devel

- db_engine_version: 10.6.11
python: '3.8'
- db_engine_version: '8.4.1'
connector_version: '0.9.3'

- db_engine_version: 10.6.11
python: '3.9'
- db_engine_version: '8.4.1'
connector_version: '1.0.2'

- python: '3.8'
connector_version: 1.0.2

- python: '3.8'
connector_version: 2.0.3

- python: '3.8'
connector_version: 2.1.1

- python: '3.9'
connector_version: 0.7.11

- python: '3.9'
connector_version: 1.0.2

- python: '3.9'
connector_version: 2.0.1

- python: '3.9'
connector_version: 2.1.1

- python: '3.10'
connector_version: 0.7.11
- db_engine_version: '8.4.1'
connector_version: '2.0.1'

- python: '3.10'
connector_version: 0.9.3
- db_engine_version: '8.4.1'
connector_version: '2.0.3'

- python: '3.10'
connector_version: 2.0.1
- db_engine_version: '10.11.8'
connector_version: '0.9.3'

- python: '3.10'
connector_version: 2.0.3
- db_engine_version: '10.11.8'
connector_version: '1.0.2'

- python: '3.8'
ansible: stable-2.16
- db_engine_version: '10.11.8'
connector_version: '2.0.1'

- python: '3.8'
ansible: stable-2.17
- db_engine_version: '10.11.8'
connector_version: '2.0.1'

- python: '3.8'
ansible: devel
- db_engine_version: '10.11.8'
ansible: stable-2.15

- python: '3.9'
ansible: stable-2.16
- db_engine_version: '8.4.1'
ansible: stable-2.15

- python: '3.9'
ansible: stable-2.17
- connector_version: '1.1.1'
db_engine_version: '8.0.38'

- python: '3.9'
ansible: devel
- connector_version: '1.1.1'
db_engine_version: '10.5.25'

services:
db_primary:
Expand Down Expand Up @@ -238,9 +215,22 @@ jobs:

- name: Restart MySQL server with settings for replication
run: |
docker exec ${{ job.services.db_primary.id }} bash -c 'echo -e [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
docker exec ${{ job.services.db_replica1.id }} bash -c 'echo -e [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf'
docker exec ${{ job.services.db_replica2.id }} bash -c 'echo -e [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf'
db_ver="${{ matrix.db_engine_version }}"
maj="${db_ver%.*.*}"
maj_min="${db_ver%.*}"
min="${maj_min#*.}"
if [[ "${{ matrix.db_engine_name }}" == "mysql" && "$maj" -eq 8 && "$min" -ge 2 ]]; then
prima_conf='[mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin\\nmysql-native-password=1'
repl1_conf='[mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin\\nmysql-native-password=1'
repl2_conf='[mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin\\nmysql-native-password=1'
else
prima_conf='[mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin'
repl1_conf='[mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin'
repl2_conf='[mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin'
fi
docker exec -e cnf=$prima_conf ${{ job.services.db_primary.id }} bash -c 'echo -e ${cnf//\\n/\n} > /etc/mysql/conf.d/replication.cnf'
docker exec -e cnf=$repl1_conf ${{ job.services.db_replica1.id }} bash -c 'echo -e ${cnf//\\n/\n} > /etc/mysql/conf.d/replication.cnf'
docker exec -e cnf=$repl2_conf ${{ job.services.db_replica2.id }} bash -c 'echo -e ${cnf//\\n/\n} > /etc/mysql/conf.d/replication.cnf'
docker restart -t 30 ${{ job.services.db_primary.id }}
docker restart -t 30 ${{ job.services.db_replica1.id }}
docker restart -t 30 ${{ job.services.db_replica2.id }}
Expand All @@ -255,10 +245,10 @@ jobs:
- name: >-
Perform integration testing against
Ansible version ${{ matrix.ansible }}
under Python ${{ matrix.python }}
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
docker-image: ubuntu2204
pre-test-cmd: >-
echo Setting db_engine_name to "${{ matrix.db_engine_name }}"...;
echo -n "${{ matrix.db_engine_name }}"
Expand All @@ -277,19 +267,15 @@ jobs:
echo -n "${{ matrix.connector_version }}"
> tests/integration/connector_version;
echo Setting Python version to "${{ matrix.python }}"...;
echo -n "${{ matrix.python }}"
> tests/integration/python;
echo Setting Ansible version to "${{ matrix.ansible }}"...;
echo -n "${{ matrix.ansible }}"
> tests/integration/ansible
target-python-version: ${{ matrix.python }}
testing-type: integration
integration-retry-on-error: false
units:
runs-on: ubuntu-22.04
name: Units (Ⓐ${{ matrix.ansible }})
name: Units (Ⓐ${{ matrix.ansible }}, Python${{ matrix.python }})
strategy:
# As soon as the first unit test fails,
# cancel the others to free up the CI queue
Expand All @@ -301,22 +287,46 @@ jobs:
- stable-2.17
- devel
python:
- 3.8
- 3.9
- '3.8'
- '3.9'
- '3.10'
- '3.11'
exclude:
- 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

- python: '3.9'
ansible: stable-2.17

- python: '3.9'
ansible: devel

- python: '3.10'
ansible: stable-2.15

- python: '3.10'
ansible: stable-2.16

- python: '3.11'
ansible: stable-2.15

- python: '3.11'
ansible: stable-2.16

steps:
- name: >-
Perform unit testing against
Ansible version ${{ matrix.ansible }}
Ansible version ${{ matrix.ansible }} and
python version ${{ matrix.python }}
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
Expand Down
Loading

0 comments on commit c503dc5

Please sign in to comment.