From ccdb5932b0a43d39ca34cd127dcbe7529ac309ab Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Wed, 6 Mar 2024 13:53:32 +0000 Subject: [PATCH] Determine if upgrade source branch is stable/ or unmaintained/ Branch renaming to unmaintanted/ breaks the gate-check-commit script when it sets the source branch for an upgrade job. This patch determines the source branch prefix dynamically in an attempt to make upgrade jobs still work from branches marked as unmaintained under wider OpenStack policy. Change-Id: I9662156fe0e9463e54ccc5c6ede0624a85887ebe --- scripts/gate-check-commit.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 0b8b1dc6e5..a06d9fbcaf 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -62,9 +62,12 @@ if [[ "${ACTION}" =~ "upgrade" ]]; then # Set the source branch for upgrade tests # Be sure to change this whenever a new stable branch # is created. + # The branch prefix will also change from 'stable/' to 'unmaintained/' + # in the future, so determine the branch prefix dynamically UPGRADE_ACTION_ARRAY=(${ACTION//_/ }) export UPGRADE_SOURCE_RELEASE=${UPGRADE_ACTION_ARRAY[1]:-'2023.2'} - export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-stable/$UPGRADE_SOURCE_RELEASE} + export UPGRADE_SOURCE_BRANCH_PREFIX=$(git branch -r --list 'origin/*' | grep $UPGRADE_SOURCE_RELEASE | sort | tail -n 1 | cut -d '/' -f 2) + export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-$UPGRADE_SOURCE_BRANCH_PREFIX/$UPGRADE_SOURCE_RELEASE} # Store the target SHA/branch export UPGRADE_TARGET_BRANCH=$(git rev-parse HEAD)