forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 3
152 lines (125 loc) · 5.78 KB
/
cluster_endtoend_upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Cluster (upgrade)
on: [push, pull_request]
jobs:
get_release_matrix:
if: github.repository == 'vitessio/vitess'
name: Get matrix for endtoend tests on Cluster (upgrade)
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-releases.outputs.matrix }}
steps:
- name: Check out to HEAD
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get latest Vitess tag
run: |
last_major_releases=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*.[0-9]*.0$' | sed 's/[a-z0-9]* refs\/tags\/v//' | sort -nr | head -n4 | tail -n3)
last_major_release_nb=$(echo "$last_major_releases" | head -n1 | sed 's/.[0-9]*.[0-9]*$//')
last_minor_release=$(git show-ref --tags | grep -E "refs/tags/v$last_major_release_nb.[0-9]*.[1-9]*$" | sed 's/[a-z0-9]* refs\/tags\/v//' | sort -nr | head -n1)
major_and_minor_releases=$last_major_releases
if [ "$last_minor_release" != " " ];
then
major_and_minor_releases=$(echo -e "$last_major_releases\n$last_minor_release")
fi
echo "latest_releases=$(echo "$major_and_minor_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
- name: Set Releases
id: set-releases
run: |
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
build:
if: github.repository == 'vitessio/vitess'
name: Run endtoend tests on Cluster (upgrade)
runs-on: ubuntu-latest
needs:
- get_release_matrix
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.get_release_matrix.outputs.matrix)}}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.12
- name: Tune the OS
run: |
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range
- name: Check out ${{ matrix.project }}
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
- name: Get dependencies
run: |
# This prepares general purpose binary dependencies
# as well as latest version specific go modules
# Setup MySQL 8.0
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
sudo apt-get update
# Install everything else we need, and configure
sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata
sudo service mysql stop
sudo service etcd stop
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
go mod download
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get update
sudo apt-get install percona-xtrabackup-24
- name: Building ${{ matrix.project }} binaries
timeout-minutes: 10
run: |
# We build latest version binaries and save them in a temporary location
source build.env
make build
mkdir -p /tmp/vitess-build-${{ matrix.project }}/
cp -R bin /tmp/vitess-build-${{ matrix.project }}/
- name: Run cluster endtoend test ${{ matrix.project }} (create cluster)
timeout-minutes: 5
run: |
# By checking out we deleted bin/ directory. We now restore our pre-built latest version binaries
cp -R /tmp/vitess-build-${{ matrix.project }}/bin .
# create the directory where we store test data; ensure it is empty:
rm -rf /tmp/vtdataroot
mkdir -p /tmp/vtdataroot
source build.env
# We pass -skip-build so that we use the latest version binaries, not HEAD binaries
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -shard 28
- name: Check out HEAD
uses: actions/checkout@v2
- name: Building HEAD binaries
timeout-minutes: 10
run: |
go mod download
source build.env
make build
mkdir -p /tmp/vitess-build-head/
cp -R bin /tmp/vitess-build-head/
- name: Run cluster endtoend test HEAD based on ${{ matrix.project }} data (upgrade path)
timeout-minutes: 5
run: |
# /tmp/vtdataroot exists from previous test
source build.env
# We built HEAD binaries manually in previous step and there's no need for the test to build.
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -shard 28
- name: Run cluster endtoend test HEAD (create cluster)
timeout-minutes: 5
run: |
# create the directory where we store test data; ensure it is empty:
rm -rf /tmp/vtdataroot
mkdir -p /tmp/vtdataroot
source build.env
# We still have the binaries from previous step. No need to build
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -shard 28
- name: Run cluster endtoend test ${{ matrix.project }} based on HEAD data (downgrade path)
timeout-minutes: 5
run: |
# /tmp/vtdataroot exists from previous test
cp -R /tmp/vitess-build-${{ matrix.project }}/bin .
source build.env
# We again built manually and there's no need for the test to build.
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -shard 28