зеркало из https://github.com/github/vitess-gh.git
Merge pull request #9745 from planetscale/improve-upgrade-downgrade-strategy
Improve upgrade downgrade workflows' strategy
This commit is contained in:
Коммит
5ad5925f28
|
@ -25,14 +25,13 @@ jobs:
|
||||||
label: Skip Upgrade Downgrade
|
label: Skip Upgrade Downgrade
|
||||||
|
|
||||||
get_latest_release:
|
get_latest_release:
|
||||||
timeout-minutes: 10
|
|
||||||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true')
|
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true')
|
||||||
name: Get latest release
|
name: Get latest release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
outputs:
|
outputs:
|
||||||
latest_release: ${{ steps.set-outpout.outputs.matrix }}
|
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out to HEAD
|
- name: Check out to HEAD
|
||||||
|
@ -40,15 +39,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get latest major release of Vitess
|
- name: Set output with latest release branch
|
||||||
|
id: output-latest-release-branch
|
||||||
run: |
|
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)
|
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
|
||||||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
|
echo $latest_release_branch
|
||||||
|
echo "::set-output name=latest_release_branch::${latest_release_branch}"
|
||||||
- name: Set output
|
|
||||||
id: set-outpout
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
|
|
||||||
|
|
||||||
upgrade_downgrade_test_e2e:
|
upgrade_downgrade_test_e2e:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
|
@ -58,9 +54,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
- get_latest_release
|
- get_latest_release
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -98,10 +91,10 @@ jobs:
|
||||||
sudo apt-get install percona-xtrabackup-24
|
sudo apt-get install percona-xtrabackup-24
|
||||||
|
|
||||||
# Checkout to the last release of Vitess
|
# 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
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.project }}
|
ref: ${{ needs.get_latest_release.outputs.latest_release }}
|
||||||
|
|
||||||
- name: Get dependencies for the last release
|
- name: Get dependencies for the last release
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -25,14 +25,13 @@ jobs:
|
||||||
label: Skip Upgrade Downgrade
|
label: Skip Upgrade Downgrade
|
||||||
|
|
||||||
get_latest_release:
|
get_latest_release:
|
||||||
timeout-minutes: 5
|
|
||||||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true')
|
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'true')
|
||||||
name: Get latest release
|
name: Get latest release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
outputs:
|
outputs:
|
||||||
latest_release: ${{ steps.set-outpout.outputs.matrix }}
|
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out to HEAD
|
- name: Check out to HEAD
|
||||||
|
@ -40,15 +39,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get latest major release of Vitess
|
- name: Set output with latest release branch
|
||||||
|
id: output-latest-release-branch
|
||||||
run: |
|
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)
|
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
|
||||||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
|
echo $latest_release_branch
|
||||||
|
echo "::set-output name=latest_release_branch::${latest_release_branch}"
|
||||||
- name: Set output
|
|
||||||
id: set-outpout
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
|
|
||||||
|
|
||||||
# This job usually execute in ± 20 minutes
|
# This job usually execute in ± 20 minutes
|
||||||
upgrade_downgrade_test_manual:
|
upgrade_downgrade_test_manual:
|
||||||
|
@ -59,9 +55,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
- get_latest_release
|
- get_latest_release
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -118,10 +111,10 @@ jobs:
|
||||||
sudo apt-get install percona-xtrabackup-24
|
sudo apt-get install percona-xtrabackup-24
|
||||||
|
|
||||||
# Checkout to the last release of Vitess
|
# 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
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.project }}
|
ref: ${{ needs.get_latest_release.outputs.latest_release }}
|
||||||
|
|
||||||
- name: Get dependencies for the last release
|
- name: Get dependencies for the last release
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
outputs:
|
outputs:
|
||||||
latest_release: ${{ steps.set-outpout.outputs.matrix }}
|
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out to HEAD
|
- name: Check out to HEAD
|
||||||
|
@ -41,15 +41,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get latest major release of Vitess
|
- name: Set output with latest release branch
|
||||||
|
id: output-latest-release-branch
|
||||||
run: |
|
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)
|
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
|
||||||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
|
echo $latest_release_branch
|
||||||
|
echo "::set-output name=latest_release_branch::${latest_release_branch}"
|
||||||
- name: Set output
|
|
||||||
id: set-outpout
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
|
|
||||||
|
|
||||||
upgrade_downgrade_test:
|
upgrade_downgrade_test:
|
||||||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
||||||
|
@ -58,9 +55,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
- get_latest_release
|
- get_latest_release
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -111,10 +105,10 @@ jobs:
|
||||||
sudo apt-get install percona-xtrabackup-24
|
sudo apt-get install percona-xtrabackup-24
|
||||||
|
|
||||||
# Checkout to the last release of Vitess
|
# 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
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.project }}
|
ref: ${{ needs.get_latest_release.outputs.latest_release }}
|
||||||
|
|
||||||
- name: Get dependencies for the last release
|
- name: Get dependencies for the last release
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
outputs:
|
outputs:
|
||||||
latest_release: ${{ steps.set-outpout.outputs.matrix }}
|
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out to HEAD
|
- name: Check out to HEAD
|
||||||
|
@ -41,15 +41,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get latest major release of Vitess
|
- name: Set output with latest release branch
|
||||||
|
id: output-latest-release-branch
|
||||||
run: |
|
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)
|
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
|
||||||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
|
echo $latest_release_branch
|
||||||
|
echo "::set-output name=latest_release_branch::${latest_release_branch}"
|
||||||
- name: Set output
|
|
||||||
id: set-outpout
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
|
|
||||||
|
|
||||||
upgrade_downgrade_test:
|
upgrade_downgrade_test:
|
||||||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
||||||
|
@ -58,9 +55,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
- get_latest_release
|
- get_latest_release
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -111,10 +105,10 @@ jobs:
|
||||||
sudo apt-get install percona-xtrabackup-24
|
sudo apt-get install percona-xtrabackup-24
|
||||||
|
|
||||||
# Checkout to the last release of Vitess
|
# 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
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.project }}
|
ref: ${{ needs.get_latest_release.outputs.latest_release }}
|
||||||
|
|
||||||
- name: Get dependencies for the last release
|
- name: Get dependencies for the last release
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
outputs:
|
outputs:
|
||||||
latest_release: ${{ steps.set-outpout.outputs.matrix }}
|
latest_release: ${{ steps.output-latest-release-branch.outputs.latest_release_branch }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out to HEAD
|
- name: Check out to HEAD
|
||||||
|
@ -41,15 +41,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get latest major release of Vitess
|
- name: Set output with latest release branch
|
||||||
|
id: output-latest-release-branch
|
||||||
run: |
|
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)
|
latest_release_branch=$(./tools/get_latest_release.sh ${{github.base_ref}})
|
||||||
echo "latest_releases=$(echo "$last_major_releases" | awk ' BEGIN { ORS = ""; print "["; } { print "\/\@{\\\"project\\\":\\\"v"$0"\\\"}\/\@"; } END { print "]"; }' | sed "s^\/\@\/\@^, ^g;s^\/\@^^g")" >> $GITHUB_ENV
|
echo $latest_release_branch
|
||||||
|
echo "::set-output name=latest_release_branch::${latest_release_branch}"
|
||||||
- name: Set output
|
|
||||||
id: set-outpout
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=matrix::{\"include\":${{ env.latest_releases }} }"
|
|
||||||
|
|
||||||
upgrade_downgrade_test:
|
upgrade_downgrade_test:
|
||||||
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
if: always() && (github.event_name != 'pull_request' || needs.get_upgrade_downgrade_label.outputs.hasLabel != 'false')
|
||||||
|
@ -58,9 +55,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- get_upgrade_downgrade_label
|
- get_upgrade_downgrade_label
|
||||||
- get_latest_release
|
- get_latest_release
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{fromJSON(needs.get_latest_release.outputs.latest_release)}}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -111,10 +105,10 @@ jobs:
|
||||||
sudo apt-get install percona-xtrabackup-24
|
sudo apt-get install percona-xtrabackup-24
|
||||||
|
|
||||||
# Checkout to the last release of Vitess
|
# 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
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.project }}
|
ref: ${{ needs.get_latest_release.outputs.latest_release }}
|
||||||
|
|
||||||
- name: Get dependencies for the last release
|
- name: Get dependencies for the last release
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -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"
|
Загрузка…
Ссылка в новой задаче