mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-28 05:11:26 -07:00
Attempt to set log-bin into docker
This commit is contained in:
parent
bcca4e832b
commit
7f69ead2a3
3 changed files with 85 additions and 88 deletions
149
.github/workflows/ansible-test-plugins.yml
vendored
149
.github/workflows/ansible-test-plugins.yml
vendored
|
@ -1,38 +1,38 @@
|
||||||
---
|
---
|
||||||
name: Plugins CI
|
name: Plugins CI
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
paths:
|
# paths:
|
||||||
- 'plugins/**'
|
# - 'plugins/**'
|
||||||
- 'tests/**'
|
# - 'tests/**'
|
||||||
- '.github/workflows/ansible-test-plugins.yml'
|
# - '.github/workflows/ansible-test-plugins.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'plugins/**'
|
- 'plugins/**'
|
||||||
- 'tests/**'
|
- 'tests/**'
|
||||||
- '.github/workflows/ansible-test-plugins.yml'
|
- '.github/workflows/ansible-test-plugins.yml'
|
||||||
schedule:
|
# schedule:
|
||||||
- cron: '0 6 * * *'
|
# - cron: '0 6 * * *'
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sanity:
|
# sanity:
|
||||||
name: "Sanity (Ansible: ${{ matrix.ansible }})"
|
# name: "Sanity (Ansible: ${{ matrix.ansible }})"
|
||||||
runs-on: ubuntu-20.04
|
# runs-on: ubuntu-20.04
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
ansible:
|
# ansible:
|
||||||
- stable-2.12
|
# - stable-2.12
|
||||||
- stable-2.13
|
# - stable-2.13
|
||||||
- stable-2.14
|
# - stable-2.14
|
||||||
- devel
|
# - devel
|
||||||
steps:
|
# steps:
|
||||||
- name: Perform sanity testing
|
# - name: Perform sanity testing
|
||||||
uses: ansible-community/ansible-test-gh-action@release/v1
|
# uses: ansible-community/ansible-test-gh-action@release/v1
|
||||||
with:
|
# with:
|
||||||
ansible-core-version: ${{ matrix.ansible }}
|
# ansible-core-version: ${{ matrix.ansible }}
|
||||||
testing-type: sanity
|
# testing-type: sanity
|
||||||
pull-request-change-detection: true
|
# pull-request-change-detection: true
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.db_engine_version }}, Connector: ${{ matrix.connector }})"
|
name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, MySQL: ${{ matrix.db_engine_version }}, Connector: ${{ matrix.connector }})"
|
||||||
|
@ -42,20 +42,20 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
db_engine_version:
|
db_engine_version:
|
||||||
- mysql:5.7.40
|
- mysql:5.7.40
|
||||||
- mysql:8.0.31
|
# - mysql:8.0.31
|
||||||
- mariadb:10.4.24
|
# - mariadb:10.4.24
|
||||||
- mariadb:10.5.18
|
# - mariadb:10.5.18
|
||||||
- mariadb:10.6.11
|
# - mariadb:10.6.11
|
||||||
- mariadb:10.7.7
|
# - mariadb:10.7.7
|
||||||
- mariadb:10.8.3
|
# - mariadb:10.8.3
|
||||||
ansible:
|
ansible:
|
||||||
- stable-2.12
|
# - stable-2.12
|
||||||
- stable-2.13
|
# - stable-2.13
|
||||||
- stable-2.14
|
- stable-2.14
|
||||||
- devel
|
# - devel
|
||||||
python:
|
python:
|
||||||
- 3.8
|
# - 3.8
|
||||||
- 3.9
|
# - 3.9
|
||||||
- 3.10
|
- 3.10
|
||||||
connector:
|
connector:
|
||||||
- pymysql==0.7.10
|
- pymysql==0.7.10
|
||||||
|
@ -128,6 +128,15 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Set MySQL server for replication
|
||||||
|
run: |
|
||||||
|
docker exec ${{ job.services.db_primary.id }} sh -c 'echo [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
|
||||||
|
docker exec ${{ job.services.db_replica1.id }} sh -c 'echo [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf'
|
||||||
|
docker exec ${{ job.services.db_replica2.id }} sh -c 'echo [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf'
|
||||||
|
docker restart ${{ job.services.db_primary.id }}
|
||||||
|
docker restart ${{ job.services.db_replica1.id }}
|
||||||
|
docker restart ${{ job.services.db_replica2.id }}
|
||||||
|
|
||||||
- name: >-
|
- name: >-
|
||||||
Perform integration testing against
|
Perform integration testing against
|
||||||
Ansible version ${{ matrix.ansible }}
|
Ansible version ${{ matrix.ansible }}
|
||||||
|
@ -143,39 +152,39 @@ jobs:
|
||||||
target-python-version: ${{ matrix.python }}
|
target-python-version: ${{ matrix.python }}
|
||||||
testing-type: integration
|
testing-type: integration
|
||||||
|
|
||||||
units:
|
# units:
|
||||||
runs-on: ubuntu-20.04
|
# runs-on: ubuntu-20.04
|
||||||
name: Units (Ⓐ${{ matrix.ansible }})
|
# name: Units (Ⓐ${{ matrix.ansible }})
|
||||||
strategy:
|
# strategy:
|
||||||
# As soon as the first unit test fails,
|
# # As soon as the first unit test fails,
|
||||||
# cancel the others to free up the CI queue
|
# # cancel the others to free up the CI queue
|
||||||
fail-fast: true
|
# fail-fast: true
|
||||||
matrix:
|
# matrix:
|
||||||
ansible:
|
# ansible:
|
||||||
- stable-2.12
|
# - stable-2.12
|
||||||
- stable-2.13
|
# - stable-2.13
|
||||||
- stable-2.14
|
# - stable-2.14
|
||||||
- devel
|
# - devel
|
||||||
python:
|
# python:
|
||||||
- 3.8
|
# - 3.8
|
||||||
- 3.9
|
# - 3.9
|
||||||
exclude:
|
# exclude:
|
||||||
- python: 3.8
|
# - python: 3.8
|
||||||
ansible: stable-2.13
|
# ansible: stable-2.13
|
||||||
- python: 3.8
|
# - python: 3.8
|
||||||
ansible: stable-2.14
|
# ansible: stable-2.14
|
||||||
- python: 3.8
|
# - python: 3.8
|
||||||
ansible: devel
|
# ansible: devel
|
||||||
- python: 3.9
|
# - python: 3.9
|
||||||
ansible: stable-2.12
|
# ansible: stable-2.12
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
- name: >-
|
# - name: >-
|
||||||
Perform unit testing against
|
# Perform unit testing against
|
||||||
Ansible version ${{ matrix.ansible }}
|
# Ansible version ${{ matrix.ansible }}
|
||||||
uses: ansible-community/ansible-test-gh-action@release/v1
|
# uses: ansible-community/ansible-test-gh-action@release/v1
|
||||||
with:
|
# with:
|
||||||
ansible-core-version: ${{ matrix.ansible }}
|
# ansible-core-version: ${{ matrix.ansible }}
|
||||||
target-python-version: ${{ matrix.python }}
|
# target-python-version: ${{ matrix.python }}
|
||||||
testing-type: units
|
# testing-type: units
|
||||||
pull-request-change-detection: true
|
# pull-request-change-detection: true
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -10,7 +10,8 @@ test-integration:
|
||||||
--network podman \
|
--network podman \
|
||||||
--publish 3307:3306 \
|
--publish 3307:3306 \
|
||||||
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
||||||
$(db_engine_version)
|
$(db_engine_version) \
|
||||||
|
mysqld --server-id 1 --log-bin=/var/lib/mysql/primary-bin
|
||||||
podman run \
|
podman run \
|
||||||
--detach \
|
--detach \
|
||||||
--name replica1 \
|
--name replica1 \
|
||||||
|
@ -19,7 +20,8 @@ test-integration:
|
||||||
--network podman \
|
--network podman \
|
||||||
--publish 3308:3306 \
|
--publish 3308:3306 \
|
||||||
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
||||||
$(db_engine_version)
|
$(db_engine_version) \
|
||||||
|
mysqld --server-id 2 --log-bin=/var/lib/mysql/replica1-bin
|
||||||
podman run \
|
podman run \
|
||||||
--detach \
|
--detach \
|
||||||
--name replica2 \
|
--name replica2 \
|
||||||
|
@ -28,7 +30,8 @@ test-integration:
|
||||||
--network podman \
|
--network podman \
|
||||||
--publish 3309:3306 \
|
--publish 3309:3306 \
|
||||||
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
--health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \
|
||||||
$(db_engine_version)
|
$(db_engine_version) \
|
||||||
|
mysqld --server-id 3 --log-bin=/var/lib/mysql/replica2-bin
|
||||||
while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
|
while ! podman healthcheck run primary && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done
|
||||||
-set -x; ansible-test integration -v --color --coverage --retry-on-error --continue-on-error --diff --docker --docker-network podman --python $(python); set +x
|
-set -x; ansible-test integration -v --color --coverage --retry-on-error --continue-on-error --diff --docker --docker-network podman --python $(python); set +x
|
||||||
rm tests/integration/db_engine_version
|
rm tests/integration/db_engine_version
|
||||||
|
|
|
@ -19,21 +19,6 @@
|
||||||
- db_engine == 'mysql'
|
- db_engine == 'mysql'
|
||||||
- db_version is version('8.0.22', '>=')
|
- db_version is version('8.0.22', '>=')
|
||||||
|
|
||||||
# We can't pass --server-id to service containers in GHA
|
|
||||||
- name: Change replica1 server_id to 2
|
|
||||||
mysql_variables:
|
|
||||||
<<: *mysql_params
|
|
||||||
login_port: '{{ mysql_replica1_port }}'
|
|
||||||
variable: server_id
|
|
||||||
value: 2
|
|
||||||
|
|
||||||
- name: Change replica2 server_id to 3
|
|
||||||
mysql_variables:
|
|
||||||
<<: *mysql_params
|
|
||||||
login_port: '{{ mysql_replica2_port }}'
|
|
||||||
variable: server_id
|
|
||||||
value: 3
|
|
||||||
|
|
||||||
# We use iF NOT EXISTS because the GITHUB Action:
|
# We use iF NOT EXISTS because the GITHUB Action:
|
||||||
# "ansible-community/ansible-test-gh-action" uses "--retry-on-error".
|
# "ansible-community/ansible-test-gh-action" uses "--retry-on-error".
|
||||||
# If test_mysql_replication fails, test will run again an without the IF
|
# If test_mysql_replication fails, test will run again an without the IF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue