-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9473 from planetscale/upgrade-downgrade-reparent
Add upgrade downgrade tests for reparent
- Loading branch information
Showing
7 changed files
with
591 additions
and
207 deletions.
There are no files selected for viewing
167 changes: 167 additions & 0 deletions
167
.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
name: Upgrade Downgrade Testing Reparent Old Vtctl | ||
on: | ||
push: | ||
pull_request: | ||
|
||
concurrency: | ||
group: format('{0}-{1}', ${{ github.ref }}, 'Upgrade Downgrade Testing Reparent Old Vtctl') | ||
cancel-in-progress: true | ||
|
||
# This test ensures that our end-to-end tests work using Vitess components | ||
# (vtctl, vttablet, etc) built on different versions. | ||
|
||
jobs: | ||
get_upgrade_downgrade_label: | ||
if: github.repository == 'vitessio/vitess' | ||
name: Get the Upgrade Downgrade pull request label | ||
runs-on: ubuntu-latest | ||
outputs: | ||
hasLabel: ${{ steps.check_label.outputs.hasLabel }} | ||
|
||
steps: | ||
- name: Check Label for PR | ||
if: github.event_name == 'pull_request' | ||
uses: Dreamcodeio/pr-has-label-action@master | ||
id: check_label | ||
with: | ||
label: Skip Upgrade Downgrade | ||
|
||
get_latest_release: | ||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true') | ||
name: Get latest release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get_upgrade_downgrade_label | ||
outputs: | ||
latest_release: ${{ steps.set-outpout.outputs.matrix }} | ||
|
||
steps: | ||
- name: Check out to HEAD | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get latest major release of Vitess | ||
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 -n1) | ||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV | ||
- name: Set output | ||
id: set-outpout | ||
run: | | ||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }" | ||
upgrade_downgrade_test: | ||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false') | ||
name: Run Upgrade Downgrade Test | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get_upgrade_downgrade_label | ||
- get_latest_release | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}} | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Tune the OS | ||
run: | | ||
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range | ||
- name: Get base dependencies | ||
run: | | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get update | ||
# Uninstall any previously installed MySQL first | ||
sudo systemctl stop apparmor | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common | ||
sudo apt-get -y autoremove | ||
sudo apt-get -y autoclean | ||
sudo deluser mysql | ||
sudo rm -rf /var/lib/mysql | ||
sudo rm -rf /etc/mysql | ||
# Install mysql80 | ||
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 | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client | ||
# Install everything else we need, and configure | ||
sudo apt-get install -y make unzip g++ etcd curl git wget eatmydata | ||
sudo service mysql stop | ||
sudo service etcd stop | ||
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263 | ||
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ | ||
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld || echo "could not remove mysqld profile" | ||
# install JUnit report formatter | ||
go get -u github.com/vitessio/go-junit-report@HEAD | ||
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 | ||
# Checkout to the last release of Vitess | ||
- name: Check out other version's code (${{ matrix.project }}) | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.project }} | ||
|
||
- name: Get dependencies for the last release | ||
run: | | ||
go mod download | ||
- name: Building last release's binaries | ||
timeout-minutes: 10 | ||
run: | | ||
source build.env | ||
make build | ||
mkdir -p /tmp/vitess-build-other/ | ||
cp -R bin /tmp/vitess-build-other/ | ||
rm -Rf bin/* | ||
# Checkout to this build's commit | ||
- name: Check out commit's code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies for this commit | ||
run: | | ||
go mod download | ||
- name: Building the binaries for this commit | ||
timeout-minutes: 10 | ||
run: | | ||
source build.env | ||
make build | ||
mkdir -p /tmp/vitess-build-current/ | ||
cp -R bin /tmp/vitess-build-current/ | ||
# Swap the binaries in the bin. Use vtctl version n-1 and keep vttablet at version n | ||
- name: Use last release's Vtctl | ||
run: | | ||
source build.env | ||
rm -f $PWD/bin/vtctl $PWD/bin/vtctld $PWD/bin/vtctlclient $PWD/bin/vtctldclient | ||
cp /tmp/vitess-build-other/bin/vtctl $PWD/bin/vtctl | ||
cp /tmp/vitess-build-other/bin/vtctld $PWD/bin/vtctld | ||
cp /tmp/vitess-build-other/bin/vtctlclient $PWD/bin/vtctlclient | ||
cp /tmp/vitess-build-other/bin/vtctldclient $PWD/bin/vtctldclient | ||
vtctl --version | ||
vttablet --version | ||
# Running a test with vtctl at version n-1 and vttablet at version n | ||
- name: Run reparent tests (vtctl=N-1, vttablet=N) | ||
run: | | ||
rm -rf /tmp/vtdataroot | ||
mkdir -p /tmp/vtdataroot | ||
source build.env | ||
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -tag upgrade_downgrade_reparent |
164 changes: 164 additions & 0 deletions
164
.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
name: Upgrade Downgrade Testing Reparent Old VTTablet | ||
on: | ||
push: | ||
pull_request: | ||
|
||
concurrency: | ||
group: format('{0}-{1}', ${{ github.ref }}, 'Upgrade Downgrade Testing Reparent Old VTTablet') | ||
cancel-in-progress: true | ||
|
||
# This test ensures that our end-to-end tests work using Vitess components | ||
# (vtctl, vttablet, etc) built on different versions. | ||
|
||
jobs: | ||
get_upgrade_downgrade_label: | ||
if: github.repository == 'vitessio/vitess' | ||
name: Get the Upgrade Downgrade pull request label | ||
runs-on: ubuntu-latest | ||
outputs: | ||
hasLabel: ${{ steps.check_label.outputs.hasLabel }} | ||
|
||
steps: | ||
- name: Check Label for PR | ||
if: github.event_name == 'pull_request' | ||
uses: Dreamcodeio/pr-has-label-action@master | ||
id: check_label | ||
with: | ||
label: Skip Upgrade Downgrade | ||
|
||
get_latest_release: | ||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true') | ||
name: Get latest release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get_upgrade_downgrade_label | ||
outputs: | ||
latest_release: ${{ steps.set-outpout.outputs.matrix }} | ||
|
||
steps: | ||
- name: Check out to HEAD | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get latest major release of Vitess | ||
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 -n1) | ||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV | ||
- name: Set output | ||
id: set-outpout | ||
run: | | ||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }" | ||
upgrade_downgrade_test: | ||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false') | ||
name: Run Upgrade Downgrade Test | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get_upgrade_downgrade_label | ||
- get_latest_release | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}} | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Tune the OS | ||
run: | | ||
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range | ||
- name: Get base dependencies | ||
run: | | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get update | ||
# Uninstall any previously installed MySQL first | ||
sudo systemctl stop apparmor | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common | ||
sudo apt-get -y autoremove | ||
sudo apt-get -y autoclean | ||
sudo deluser mysql | ||
sudo rm -rf /var/lib/mysql | ||
sudo rm -rf /etc/mysql | ||
# Install mysql80 | ||
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 | ||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client | ||
# Install everything else we need, and configure | ||
sudo apt-get install -y make unzip g++ etcd curl git wget eatmydata | ||
sudo service mysql stop | ||
sudo service etcd stop | ||
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263 | ||
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ | ||
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld || echo "could not remove mysqld profile" | ||
# install JUnit report formatter | ||
go get -u github.com/vitessio/go-junit-report@HEAD | ||
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 | ||
# Checkout to the last release of Vitess | ||
- name: Check out other version's code (${{ matrix.project }}) | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.project }} | ||
|
||
- name: Get dependencies for the last release | ||
run: | | ||
go mod download | ||
- name: Building last release's binaries | ||
timeout-minutes: 10 | ||
run: | | ||
source build.env | ||
make build | ||
mkdir -p /tmp/vitess-build-other/ | ||
cp -R bin /tmp/vitess-build-other/ | ||
rm -Rf bin/* | ||
# Checkout to this build's commit | ||
- name: Check out commit's code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies for this commit | ||
run: | | ||
go mod download | ||
- name: Building the binaries for this commit | ||
timeout-minutes: 10 | ||
run: | | ||
source build.env | ||
make build | ||
mkdir -p /tmp/vitess-build-current/ | ||
cp -R bin /tmp/vitess-build-current/ | ||
# Swap the binaries. Use vtctl version n and keep vttablet at version n-1 | ||
- name: Use current version Vtctl, and other version VTTablet | ||
run: | | ||
source build.env | ||
rm -f $PWD/bin/vttablet | ||
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet | ||
vtctl --version | ||
vttablet --version | ||
# Running a test with vtctl at version n and vttablet at version n-1 | ||
- name: Run reparent tests (vtctl=N, vttablet=N-1) | ||
run: | | ||
rm -rf /tmp/vtdataroot | ||
mkdir -p /tmp/vtdataroot | ||
source build.env | ||
eatmydata -- go run test.go -skip-build -keep-data -docker=false -print-log -follow -tag upgrade_downgrade_reparent |
Oops, something went wrong.