Merge pull request #9745 from planetscale/improve-upgrade-downgrade-strategy

Improve upgrade downgrade workflows' strategy
This commit is contained in:
FlorentP 2022-02-23 12:21:09 +01:00 коммит произвёл GitHub
Родитель 8606beb9fd 6f8b63fb12
Коммит 5ad5925f28
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 81 добавлений и 72 удалений

Просмотреть файл

@ -25,14 +25,13 @@ jobs:
label: Skip Upgrade Downgrade
get_latest_release:
timeout-minutes: 10
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 }}
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
steps:
- name: Check out to HEAD
@ -40,15 +39,12 @@ jobs:
with:
fetch-depth: 0
- name: Get latest major release of Vitess
- name: Set output with latest release branch
id: output-latest-release-branch
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 }} }"
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
echo $latest_release_branch
echo "::set-output name=latest_release_branch::${latest_release_branch}"
upgrade_downgrade_test_e2e:
timeout-minutes: 60
@ -58,9 +54,6 @@ jobs:
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
@ -98,10 +91,10 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ matrix.project }})
- name: Check out other version's code (${{ needs.get_latest_release.outputs.latest_release }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
ref: ${{ needs.get_latest_release.outputs.latest_release }}
- name: Get dependencies for the last release
run: |

Просмотреть файл

@ -25,14 +25,13 @@ jobs:
label: Skip Upgrade Downgrade
get_latest_release:
timeout-minutes: 5
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 }}
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
steps:
- name: Check out to HEAD
@ -40,15 +39,12 @@ jobs:
with:
fetch-depth: 0
- name: Get latest major release of Vitess
- name: Set output with latest release branch
id: output-latest-release-branch
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 }} }"
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
echo $latest_release_branch
echo "::set-output name=latest_release_branch::${latest_release_branch}"
# This job usually execute in ± 20 minutes
upgrade_downgrade_test_manual:
@ -59,9 +55,6 @@ jobs:
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
@ -118,10 +111,10 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Checkout to the other version's code (${{ matrix.project }})
- name: Checkout to the other version's code (${{ needs.get_latest_release.outputs.latest_release }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
ref: ${{ needs.get_latest_release.outputs.latest_release }}
- name: Get dependencies for the last release
run: |

Просмотреть файл

@ -33,7 +33,7 @@ jobs:
needs:
- get_upgrade_downgrade_label
outputs:
latest_release: ${{ steps.set-outpout.outputs.matrix }}
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
steps:
- name: Check out to HEAD
@ -41,15 +41,12 @@ jobs:
with:
fetch-depth: 0
- name: Get latest major release of Vitess
- name: Set output with latest release branch
id: output-latest-release-branch
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 }} }"
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
echo $latest_release_branch
echo "::set-output name=latest_release_branch::${latest_release_branch}"
upgrade_downgrade_test:
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
@ -58,9 +55,6 @@ jobs:
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
@ -111,10 +105,10 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ matrix.project }})
- name: Check out other version's code (${{ needs.get_latest_release.outputs.latest_release }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
ref: ${{ needs.get_latest_release.outputs.latest_release }}
- name: Get dependencies for the last release
run: |

Просмотреть файл

@ -33,7 +33,7 @@ jobs:
needs:
- get_upgrade_downgrade_label
outputs:
latest_release: ${{ steps.set-outpout.outputs.matrix }}
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
steps:
- name: Check out to HEAD
@ -41,15 +41,12 @@ jobs:
with:
fetch-depth: 0
- name: Get latest major release of Vitess
- name: Set output with latest release branch
id: output-latest-release-branch
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 }} }"
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
echo $latest_release_branch
echo "::set-output name=latest_release_branch::${latest_release_branch}"
upgrade_downgrade_test:
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
@ -58,9 +55,6 @@ jobs:
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
@ -111,10 +105,10 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ matrix.project }})
- name: Check out other version's code (${{ needs.get_latest_release.outputs.latest_release }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
ref: ${{ needs.get_latest_release.outputs.latest_release }}
- name: Get dependencies for the last release
run: |

Просмотреть файл

@ -33,7 +33,7 @@ jobs:
needs:
- get_upgrade_downgrade_label
outputs:
latest_release: ${{ steps.set-outpout.outputs.matrix }}
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
steps:
- name: Check out to HEAD
@ -41,15 +41,12 @@ jobs:
with:
fetch-depth: 0
- name: Get latest major release of Vitess
- name: Set output with latest release branch
id: output-latest-release-branch
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 }} }"
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
echo $latest_release_branch
echo "::set-output name=latest_release_branch::${latest_release_branch}"
upgrade_downgrade_test:
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
@ -58,9 +55,6 @@ jobs:
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
@ -111,10 +105,10 @@ jobs:
sudo apt-get install percona-xtrabackup-24
# Checkout to the last release of Vitess
- name: Check out other version's code (${{ matrix.project }})
- name: Check out other version's code (${{ needs.get_latest_release.outputs.latest_release }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.project }}
ref: ${{ needs.get_latest_release.outputs.latest_release }}
- name: Get dependencies for the last release
run: |

41
tools/get_latest_release.sh Executable file
Просмотреть файл

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright 2022 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is used to build and copy the Angular 2 based vtctld UI
# into the release folder (app) for checkin. Prior to running this script,
# bootstrap.sh and bootstrap_web.sh should already have been run.
# github.base_ref $1
target_release=""
base_release_branch=$(echo "$1" | grep -E 'release-[0-9]*.0$')
if [ "$base_release_branch" != "" ]; then
major_release=$(echo "$base_release_branch" | sed 's/release-*//' | sed 's/\.0//')
target_major_release=$((major_release-1))
target_release_number=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*.[0-9]*.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -nr | head -n1)
target_release="v$target_release_number"
else
target_major_release=$(git show-ref | grep -E 'refs/remotes/origin/release-[0-9]*\.0$' | sed 's/[a-z0-9]* refs\/remotes\/origin\/release-//' | sed 's/\.0//' | sort -nr | head -n1)
target_release_number=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*.[0-9]*.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -nr | head -n1)
target_release="v$target_release_number"
if [ -z "$target_release_number" ]
then
target_release="release-$target_major_release.0"
fi
fi
echo "$target_release"