Skip to content

Commit fc29ef2

Browse files
authored
Refactor backup_pitr into two distinct CI tests: builtin vs Xtrabackup (#13395)
each of those two is further split by mysql80 and mysql57. The reasonsing for this split is that for 'builtin' we want to test with mysql-server, whereas for 'Xtrabackup' we want to test with percona-server. It much easier to do so on two distinct CI workflows than on a single one. Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
1 parent f47c606 commit fc29ef2

10 files changed

Lines changed: 617 additions & 262 deletions

.github/workflows/cluster_endtoend_backup_pitr.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ jobs:
8484
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
8585
run: |
8686
87-
# Setup Percona Server for MySQL 8.0
87+
# Get key to latest MySQL repo
88+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
89+
# Setup MySQL 8.0
90+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
91+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
92+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
8893
sudo apt-get update
89-
sudo apt-get install -y lsb-release gnupg2 curl
90-
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
91-
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
92-
sudo percona-release setup ps80
93-
sudo apt-get update
94-
9594
# Install everything else we need, and configure
96-
sudo apt-get install -y percona-server-server percona-server-client make unzip g++ etcd git wget eatmydata xz-utils libncurses5
95+
sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata xz-utils libncurses5
9796
9897
sudo service mysql stop
9998
sudo service etcd stop
@@ -104,8 +103,6 @@ jobs:
104103
# install JUnit report formatter
105104
go install github.com/vitessio/go-junit-report@HEAD
106105
107-
sudo apt-get install percona-xtrabackup-80 lz4
108-
109106
- name: Setup launchable dependencies
110107
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main'
111108
run: |

.github/workflows/cluster_endtoend_backup_pitr_mysql57.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ env:
1313
LAUNCHABLE_WORKSPACE: "vitess-app"
1414
GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}"
1515

16-
# This is used if we need to pin the xtrabackup version used in tests.
17-
# If this is NOT set then the latest version available will be used.
18-
#XTRABACKUP_VERSION: "2.4.24-1"
19-
2016
jobs:
2117
build:
2218
name: Run endtoend tests on Cluster (backup_pitr) mysql57
@@ -118,18 +114,6 @@ jobs:
118114
# install JUnit report formatter
119115
go install github.com/vitessio/go-junit-report@HEAD
120116
121-
wget "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"
122-
sudo apt-get install -y gnupg2
123-
sudo dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb"
124-
sudo apt-get update
125-
if [[ -n $XTRABACKUP_VERSION ]]; then
126-
debfile="percona-xtrabackup-24_$XTRABACKUP_VERSION.$(lsb_release -sc)_amd64.deb"
127-
wget "https://repo.percona.com/pxb-24/apt/pool/main/p/percona-xtrabackup-24/$debfile"
128-
sudo apt install -y "./$debfile"
129-
else
130-
sudo apt-get install -y percona-xtrabackup-24
131-
fi
132-
133117
- name: Setup launchable dependencies
134118
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main'
135119
run: |
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows"
2+
3+
name: Cluster (backup_pitr_xtrabackup)
4+
on: [push, pull_request]
5+
concurrency:
6+
group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (backup_pitr_xtrabackup)')
7+
cancel-in-progress: true
8+
9+
permissions: read-all
10+
11+
env:
12+
LAUNCHABLE_ORGANIZATION: "vitess"
13+
LAUNCHABLE_WORKSPACE: "vitess-app"
14+
GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}"
15+
16+
jobs:
17+
build:
18+
name: Run endtoend tests on Cluster (backup_pitr_xtrabackup)
19+
runs-on: ubuntu-22.04
20+
21+
steps:
22+
- name: Skip CI
23+
run: |
24+
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
25+
echo "skipping CI due to the 'Skip CI' label"
26+
exit 1
27+
fi
28+
29+
- name: Check if workflow needs to be skipped
30+
id: skip-workflow
31+
run: |
32+
skip='false'
33+
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
34+
skip='true'
35+
fi
36+
echo Skip ${skip}
37+
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
38+
39+
- name: Check out code
40+
if: steps.skip-workflow.outputs.skip-workflow == 'false'
41+
uses: actions/checkout@v3
42+
43+
- name: Check for changes in relevant files
44+
if: steps.skip-workflow.outputs.skip-workflow == 'false'
45+
uses: frouioui/paths-filter@main
46+
id: changes
47+
with:
48+
token: ''
49+
filters: |
50+
end_to_end:
51+
- 'go/**/*.go'
52+
- 'test.go'
53+
- 'Makefile'
54+
- 'build.env'
55+
- 'go.sum'
56+
- 'go.mod'
57+
- 'proto/*.proto'
58+
- 'tools/**'
59+
- 'config/**'
60+
- 'bootstrap.sh'
61+
- '.github/workflows/cluster_endtoend_backup_pitr_xtrabackup.yml'
62+
63+
- name: Set up Go
64+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
65+
uses: actions/setup-go@v4
66+
with:
67+
go-version: 1.20.5
68+
69+
- name: Set up python
70+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
71+
uses: actions/setup-python@v4
72+
73+
- name: Tune the OS
74+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
75+
run: |
76+
# Limit local port range to not use ports that overlap with server side
77+
# ports that we listen on.
78+
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535"
79+
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
80+
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
81+
sudo sysctl -p /etc/sysctl.conf
82+
83+
- name: Get dependencies
84+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
85+
run: |
86+
87+
# Setup Percona Server for MySQL 8.0
88+
sudo apt-get update
89+
sudo apt-get install -y lsb-release gnupg2 curl
90+
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
91+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
92+
sudo percona-release setup ps80
93+
sudo apt-get update
94+
95+
# Install everything else we need, and configure
96+
sudo apt-get install -y percona-server-server percona-server-client make unzip g++ etcd git wget eatmydata xz-utils libncurses5
97+
98+
sudo service mysql stop
99+
sudo service etcd stop
100+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
101+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
102+
go mod download
103+
104+
# install JUnit report formatter
105+
go install github.com/vitessio/go-junit-report@HEAD
106+
107+
sudo apt-get install percona-xtrabackup-80 lz4
108+
109+
- name: Setup launchable dependencies
110+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main'
111+
run: |
112+
# Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up
113+
pip3 install --user launchable~=1.0 > /dev/null
114+
115+
# verify that launchable setup is all correct.
116+
launchable verify || true
117+
118+
# Tell Launchable about the build you are producing and testing
119+
launchable record build --name "$GITHUB_RUN_ID" --source .
120+
121+
- name: Run cluster endtoend test
122+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
123+
timeout-minutes: 45
124+
run: |
125+
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
126+
# which musn't be more than 107 characters long.
127+
export VTDATAROOT="/tmp/"
128+
source build.env
129+
130+
set -x
131+
132+
# run the tests however you normally do, then produce a JUnit XML file
133+
eatmydata -- go run test.go -docker=false -follow -shard backup_pitr_xtrabackup | tee -a output.txt | go-junit-report -set-exit-code > report.xml
134+
135+
- name: Print test output and Record test result in launchable
136+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
137+
run: |
138+
# send recorded tests to launchable
139+
launchable record tests --build "$GITHUB_RUN_ID" go-test . || true
140+
141+
# print test output
142+
cat output.txt
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows"
2+
3+
name: Cluster (backup_pitr_xtrabackup) mysql57
4+
on: [push, pull_request]
5+
concurrency:
6+
group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (backup_pitr_xtrabackup) mysql57')
7+
cancel-in-progress: true
8+
9+
permissions: read-all
10+
11+
env:
12+
LAUNCHABLE_ORGANIZATION: "vitess"
13+
LAUNCHABLE_WORKSPACE: "vitess-app"
14+
GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}"
15+
16+
# This is used if we need to pin the xtrabackup version used in tests.
17+
# If this is NOT set then the latest version available will be used.
18+
#XTRABACKUP_VERSION: "2.4.24-1"
19+
20+
jobs:
21+
build:
22+
name: Run endtoend tests on Cluster (backup_pitr_xtrabackup) mysql57
23+
runs-on: ubuntu-22.04
24+
25+
steps:
26+
- name: Skip CI
27+
run: |
28+
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
29+
echo "skipping CI due to the 'Skip CI' label"
30+
exit 1
31+
fi
32+
33+
- name: Check if workflow needs to be skipped
34+
id: skip-workflow
35+
run: |
36+
skip='false'
37+
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
38+
skip='true'
39+
fi
40+
echo Skip ${skip}
41+
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
42+
43+
- name: Check out code
44+
if: steps.skip-workflow.outputs.skip-workflow == 'false'
45+
uses: actions/checkout@v3
46+
47+
- name: Check for changes in relevant files
48+
if: steps.skip-workflow.outputs.skip-workflow == 'false'
49+
uses: frouioui/paths-filter@main
50+
id: changes
51+
with:
52+
token: ''
53+
filters: |
54+
end_to_end:
55+
- 'go/**/*.go'
56+
- 'test.go'
57+
- 'Makefile'
58+
- 'build.env'
59+
- 'go.sum'
60+
- 'go.mod'
61+
- 'proto/*.proto'
62+
- 'tools/**'
63+
- 'config/**'
64+
- 'bootstrap.sh'
65+
- '.github/workflows/cluster_endtoend_backup_pitr_xtrabackup_mysql57.yml'
66+
67+
- name: Set up Go
68+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
69+
uses: actions/setup-go@v4
70+
with:
71+
go-version: 1.20.5
72+
73+
- name: Set up python
74+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
75+
uses: actions/setup-python@v4
76+
77+
- name: Tune the OS
78+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
79+
run: |
80+
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535"
81+
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
82+
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
83+
sudo sysctl -p /etc/sysctl.conf
84+
85+
- name: Get dependencies
86+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
87+
run: |
88+
sudo apt-get update
89+
90+
# Uninstall any previously installed MySQL first
91+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
92+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
93+
94+
sudo systemctl stop apparmor
95+
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
96+
sudo apt-get -y autoremove
97+
sudo apt-get -y autoclean
98+
sudo deluser mysql
99+
sudo rm -rf /var/lib/mysql
100+
sudo rm -rf /etc/mysql
101+
102+
# Get key to latest MySQL repo
103+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
104+
105+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
106+
# Bionic packages are still compatible for Jammy since there's no MySQL 5.7
107+
# packages for Jammy.
108+
echo mysql-apt-config mysql-apt-config/repo-codename select bionic | sudo debconf-set-selections
109+
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
110+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
111+
sudo apt-get update
112+
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7* libncurses5
113+
114+
sudo apt-get install -y make unzip g++ etcd curl git wget eatmydata
115+
sudo service mysql stop
116+
sudo service etcd stop
117+
118+
# install JUnit report formatter
119+
go install github.com/vitessio/go-junit-report@HEAD
120+
121+
wget "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"
122+
sudo apt-get install -y gnupg2
123+
sudo dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb"
124+
sudo apt-get update
125+
if [[ -n $XTRABACKUP_VERSION ]]; then
126+
debfile="percona-xtrabackup-24_$XTRABACKUP_VERSION.$(lsb_release -sc)_amd64.deb"
127+
wget "https://repo.percona.com/pxb-24/apt/pool/main/p/percona-xtrabackup-24/$debfile"
128+
sudo apt install -y "./$debfile"
129+
else
130+
sudo apt-get install -y percona-xtrabackup-24
131+
fi
132+
133+
- name: Setup launchable dependencies
134+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main'
135+
run: |
136+
# Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up
137+
pip3 install --user launchable~=1.0 > /dev/null
138+
139+
# verify that launchable setup is all correct.
140+
launchable verify || true
141+
142+
# Tell Launchable about the build you are producing and testing
143+
launchable record build --name "$GITHUB_RUN_ID" --source .
144+
145+
- name: Run cluster endtoend test
146+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
147+
timeout-minutes: 45
148+
run: |
149+
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
150+
# which musn't be more than 107 characters long.
151+
export VTDATAROOT="/tmp/"
152+
source build.env
153+
154+
set -x
155+
156+
# run the tests however you normally do, then produce a JUnit XML file
157+
eatmydata -- go run test.go -docker=false -follow -shard backup_pitr_xtrabackup | tee -a output.txt | go-junit-report -set-exit-code > report.xml
158+
159+
- name: Print test output and Record test result in launchable
160+
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
161+
run: |
162+
# send recorded tests to launchable
163+
launchable record tests --build "$GITHUB_RUN_ID" go-test . || true
164+
165+
# print test output
166+
cat output.txt

0 commit comments

Comments
 (0)