Skip to content

Commit

Permalink
[release-17.0] Refactor Upgrade downgrade tests (#14782) (#14831)
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <manan@planetscale.com>
Co-authored-by: Manan Gupta <35839558+GuptaManan100@users.noreply.github.com>
Co-authored-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
3 people authored Dec 27, 2023
1 parent e630548 commit 6e73e2e
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 359 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/upgrade_downgrade_test_backups_e2e.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Downgrade Testing - Backups - E2E
name: Backups - E2E - Upgrade Downgrade Testing
on:
push:
pull_request:
Expand Down Expand Up @@ -32,11 +32,8 @@ jobs:
upgrade_downgrade_test_e2e:
timeout-minutes: 60
if: always() && needs.get_previous_release.result == 'success'
name: Run Upgrade Downgrade Test - Backups - E2E
runs-on: ubuntu-22.04
needs:
- get_previous_release

steps:
- name: Skip CI
Expand All @@ -59,6 +56,16 @@ jobs:
- name: Check out commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
if: steps.skip-workflow.outputs.skip-workflow == 'false'
id: output-previous-release-ref
run: |
previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}})
echo $previous_release_ref
echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT
- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
Expand Down Expand Up @@ -117,11 +124,11 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ needs.get_previous_release.outputs.previous_release }})
- name: Check out other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v3
with:
ref: ${{ needs.get_previous_release.outputs.previous_release }}
ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }}

- name: Get dependencies for the last release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Downgrade Testing - Backups - E2E - Next Release
name: Backups - E2E - Next Release - Upgrade Downgrade Testing
on:
push:
pull_request:
Expand All @@ -10,33 +10,11 @@ concurrency:
permissions: read-all

jobs:
get_next_release:
if: always()
name: Get Latest Release - Backups - E2E - Next Release
runs-on: ubuntu-22.04
outputs:
next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

steps:
- name: Check out to HEAD
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-next-release-ref
run: |
next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}})
echo $next_release_ref
echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT

upgrade_downgrade_test_e2e:
timeout-minutes: 60
if: always() && needs.get_next_release.result == 'success'
name: Run Upgrade Downgrade Test - Backups - E2E - Next Release
runs-on: ubuntu-22.04
needs:
- get_next_release

steps:
- name: Skip CI
Expand All @@ -46,23 +24,31 @@ jobs:
exit 1
fi
- name: Check out commit's code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-next-release-ref
run: |
next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}})
echo $next_release_ref
echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then
if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
- name: Check out commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
Expand Down Expand Up @@ -120,11 +106,11 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the next release of Vitess
- name: Check out other version's code (${{ needs.get_next_release.outputs.next_release }})
- name: Check out other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v3
with:
ref: ${{ needs.get_next_release.outputs.next_release }}
ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

- name: Get dependencies for the next release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand Down
38 changes: 13 additions & 25 deletions .github/workflows/upgrade_downgrade_test_backups_manual.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Downgrade Testing - Backups - Manual
name: Backups - Manual - Upgrade Downgrade Testing
on:
push:
pull_request:
Expand All @@ -10,34 +10,12 @@ concurrency:
permissions: read-all

jobs:
get_previous_release:
if: always()
name: Get Previous Release - Backups - Manual
runs-on: ubuntu-22.04
outputs:
previous_release: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }}

steps:
- name: Check out to HEAD
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-previous-release-ref
run: |
previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}})
echo $previous_release_ref
echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT

# This job usually execute in ± 20 minutes
upgrade_downgrade_test_manual:
timeout-minutes: 40
if: always() && (needs.get_previous_release.result == 'success')
name: Run Upgrade Downgrade Test - Backups - Manual
runs-on: ubuntu-22.04
needs:
- get_previous_release

steps:
- name: Skip CI
Expand All @@ -61,6 +39,16 @@ jobs:
- name: Checkout to commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-previous-release-ref
if: steps.skip-workflow.outputs.skip-workflow == 'false'
run: |
previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}})
echo $previous_release_ref
echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT
- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
Expand Down Expand Up @@ -138,11 +126,11 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Checkout to the other version's code (${{ needs.get_previous_release.outputs.previous_release }})
- name: Checkout to the other version's code (${{ steps.output-previous-release-ref.outputs.previous_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v3
with:
ref: ${{ needs.get_previous_release.outputs.previous_release }}
ref: ${{ steps.output-previous-release-ref.outputs.previous_release_ref }}

- name: Get dependencies for the last release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upgrade Downgrade Testing - Backups - Manual - Next Release
name: Backups - Manual - Next Release - Upgrade Downgrade Testing
on:
push:
pull_request:
Expand All @@ -10,34 +10,12 @@ concurrency:
permissions: read-all

jobs:
get_next_release:
if: always()
name: Get Previous Release - Backups - Manual - Next Release
runs-on: ubuntu-22.04
outputs:
next_release: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

steps:
- name: Check out to HEAD
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-next-release-ref
run: |
next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}})
echo $next_release_ref
echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT

# This job usually execute in ± 20 minutes
upgrade_downgrade_test_manual:
timeout-minutes: 40
if: always() && (needs.get_next_release.result == 'success')
name: Run Upgrade Downgrade Test - Backups - Manual - Next Release
runs-on: ubuntu-22.04
needs:
- get_next_release

steps:
- name: Skip CI
Expand All @@ -47,24 +25,32 @@ jobs:
exit 1
fi
# Checkout to this build's commit
- name: Checkout to commit's code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set output with latest release branch
id: output-next-release-ref
run: |
next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}})
echo $next_release_ref
echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
if [[ "${{needs.get_next_release.outputs.next_release}}" == "" ]]; then
if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
# Checkout to this build's commit
- name: Checkout to commit's code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
Expand Down Expand Up @@ -138,14 +124,14 @@ jobs:
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
sudo apt-get install -y percona-xtrabackup-24
# Checkout to the next release of Vitess
- name: Checkout to the other version's code (${{ needs.get_next_release.outputs.next_release }})
- name: Checkout to the other version's code (${{ steps.output-next-release-ref.outputs.next_release_ref }})
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v3
with:
ref: ${{ needs.get_next_release.outputs.next_release }}
ref: ${{ steps.output-next-release-ref.outputs.next_release_ref }}

- name: Get dependencies for the next release
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand All @@ -157,7 +143,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -182,7 +168,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/
Expand Down
Loading

0 comments on commit 6e73e2e

Please sign in to comment.