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
This commit is contained in:
Jonathan Rosser 2024-03-06 13:53:32 +00:00
parent 022c9c4c22
commit ccdb5932b0

View File

@ -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)