Restrict migration scripts that are not runable for 22.12 upgrade

Add execution exclusion for migration scripts:
  63-helm-v2-to-v3-rel_migration.sh
  64-upgrade-cert-manager.sh
  65-k8s-app-upgrade.sh

This skips running the scripts above for 22.06 to 22.12 upgrade.

TCs:
    upgrade 22.06 -> 22.12 completed successfully

Story: 2009303
Task: 46219
Change-Id: I7353d06033b6a014d8654220624c856d7d900e19
Signed-off-by: Bin Qian <bin.qian@windriver.com>
This commit is contained in:
Bin Qian 2022-09-06 04:24:23 +00:00
parent 9b91a679be
commit 61f4385bf3
3 changed files with 27 additions and 8 deletions

View File

@ -144,6 +144,12 @@ function migrate_apps {
}
if [ "$ACTION" == "activate" ]; then
# TODO: double check the inclusive condition.
if [[ "$TO_RELEASE" == "22.12" && "$FROM_RELEASE" == "22.06" ]]; then
log "upgrade to 22.12, skip"
exit 0
fi
log "$NAME: Starting Helm release migration from release $FROM_RELEASE to $TO_RELEASE with action $ACTION"
install_helm_2to3
get_helmv2_config

View File

@ -27,11 +27,22 @@ FROM_RELEASE=$1
TO_RELEASE=$2
ACTION=$3
# This will log to /var/log/platform.log
function log {
logger -p local1.info $1
}
# only run this script during upgrade-activate
if [ "$ACTION" != "activate" ]; then
exit 0
fi
# TODO: double check the inclusive condition.
if [[ "$TO_RELEASE" == "22.12" && "$FROM_RELEASE" == "22.06" ]]; then
log "upgrade to 22.12, skip"
exit 0
fi
PLATFORM_APPLICATION_PATH='/usr/local/share/applications/helm'
CONFIG_PERMDIR="/opt/platform/config/${TO_RELEASE}"
PATH=$PATH:/usr/local/sbin
@ -48,11 +59,6 @@ REMOVE_RESULT_ATTEMPTS=48 # ~8 min to remove app
source /etc/platform/openrc
source /etc/platform/platform.conf
# This will log to /var/log/platform.log
function log {
logger -p local1.info $1
}
EXISTING_APP_NAME='cert-manager'
EXISTING_APP_INFO=$(system application-show $EXISTING_APP_NAME --column app_version --column status --format yaml)
EXISTING_APP_VERSION=$(echo ${EXISTING_APP_INFO} | sed 's/.*app_version:[[:space:]]\(\S*\).*/\1/')

View File

@ -32,9 +32,6 @@ UPLOAD_RESULT_ATTEMPTS=24 # ~4 min to upload app
UPDATE_RESULT_SLEEP=30
UPDATE_RESULT_ATTEMPTS=30 # ~15 min to update app
source /etc/platform/openrc
source /etc/platform/platform.conf
# This will log to /var/log/platform.log
function log {
logger -p local1.info $1
@ -61,6 +58,16 @@ function verify_apps_are_not_recovering {
log "$NAME: Starting Kubernetes application updates from release $FROM_RELEASE to $TO_RELEASE with action $ACTION"
if [ "$ACTION" == "activate" ]; then
# TODO: double check the inclusive condition.
if [ "$TO_RELEASE" != "22.06" ]; then
log "not upgrading to 22.06, skip"
exit 0
fi
# move the costly source command in the if branch, so only execute when needed.
source /etc/platform/openrc
source /etc/platform/platform.conf
for tries in $(seq 1 $RECOVER_RESULT_ATTEMPTS); do
if verify_apps_are_not_recovering; then
break