Find the right release file for ffu mixed version upgrade.

By setting ffu_overcloud_upgrade in the featureset this change find
the right previous version for ffu and thus the correct release file.

This also refactor all the upgrade/update related function.

This whole section of the ci code is related to this tech-debt.
Related-Bug: #1749978

Change-Id: I962c2e4ad4eb522839deb904e0c67fb6a5d0ead9
This commit is contained in:
Sofer Athlan-Guyot 2018-02-01 15:04:12 +01:00
parent 5fa75fc352
commit 33afffa972
2 changed files with 48 additions and 15 deletions

View File

@ -1,8 +1,23 @@
function previous_release_from {
# works even when $1 is empty string or not provided at all
local RELEASE="$1"
local release="${1:-master}"
local type="${2:-mixed_upgrade}"
local previous_version=""
case "${type}" in
'mixed_upgrade')
previous_version=$(previous_release_mixed_upgrade_case "${release}");;
'ffu_upgrade')
previous_version=$(previous_release_ffu_upgrade_case "${release}");;
*)
echo "UNKNOWN_TYPE"
return 1
;;
esac
echo "${previous_version}"
}
case "$RELEASE" in
function previous_release_mixed_upgrade_case {
local release="${1:-master}"
case "${release}" in
''|master)
# NOTE: we need to update this when we cut a stable branch
echo "queens"
@ -26,16 +41,29 @@ function previous_release_from {
esac
}
function is_featureset_mixed_upgrade {
local FEATURESET_FILE="$1"
function previous_release_ffu_upgrade_case {
local release="${1:-master}"
[ $(shyaml get-value mixed_upgrade "False"< $FEATURESET_FILE) = "True" ]
case "${release}" in
''|master)
# NOTE: we need to update this when we cut a stable branch
echo "newton"
;;
queens)
echo "newton"
;;
*)
echo "INVALID_RELEASE_FOR_FFU"
return 1
;;
esac
}
function is_featureset_overcloud_update {
local FEATURESET_FILE="$1"
function is_featureset {
local type="${1}"
local featureset_file="${2}"
[ $(shyaml get-value overcloud_update "False"< $FEATURESET_FILE) = "True" ]
[ $(shyaml get-value "${type}" "False"< "${featureset_file}") = "True" ]
}
function run_with_timeout {

View File

@ -127,17 +127,22 @@ for JOB_TYPE_PART in $(sed 's/-/ /g' <<< "${TOCI_JOBTYPE:-}") ; do
featureset*)
FEATURESET_FILE="$LWD/config/general_config/$JOB_TYPE_PART.yml"
FEATURESET_CONF="$FEATURESET_CONF --extra-vars @$FEATURESET_FILE"
MIXED_UPGRADE_TYPE=''
# Order matters. ffu featureset has both mixed version and ffu_overcloud_upgrade.
if is_featureset ffu_overcloud_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='ffu_upgrade'
elif is_featureset mixed_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
MIXED_UPGRADE_TYPE='mixed_upgrade'
elif is_featureset overcloud_update "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,overcloud-update"
fi
# Set UPGRADE_RELEASE if applicable
if is_featureset_mixed_upgrade "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
export UPGRADE_RELEASE=$(previous_release_from "$STABLE_RELEASE")
if [ -n "${MIXED_UPGRADE_TYPE}" ]; then
export UPGRADE_RELEASE=$(previous_release_from "${STABLE_RELEASE}" "${MIXED_UPGRADE_TYPE}")
QUICKSTART_RELEASE="$QUICKSTART_RELEASE-undercloud-$UPGRADE_RELEASE-overcloud"
# Run overcloud-upgrade tag only in upgrades jobs
TAGS="$TAGS,overcloud-upgrade"
fi
if is_featureset_overcloud_update "$TRIPLEO_ROOT/tripleo-quickstart/config/general_config/$JOB_TYPE_PART.yml"; then
TAGS="$TAGS,overcloud-update"
fi
;;
ovb)
OVB=1