From f576338e71ac66374929d3d4d7aafdabf0a72d4c Mon Sep 17 00:00:00 2001 From: vdelendik Date: Tue, 15 Aug 2023 17:22:02 +0300 Subject: [PATCH] #566: organize v2.4 upgrade script --- patch/2.4.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ zebrunner.sh | 10 ++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100755 patch/2.4.sh diff --git a/patch/2.4.sh b/patch/2.4.sh new file mode 100755 index 00000000..8bc67505 --- /dev/null +++ b/patch/2.4.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# shellcheck disable=SC1091 +source patch/utility.sh + +TARGET_VERSION=2.4 + +source backup/settings.env +SOURCE_VERSION=${ZBR_VERSION} +#echo SOURCE_VERSION: $SOURCE_VERSION + +if ! [[ "${TARGET_VERSION}" > "${SOURCE_VERSION}" ]]; then + #target Zebrunner version less or equal existing + echo "No need to perform upgrade to ${TARGET_VERSION}" + exit 2 +fi + +echo "Upgrading Zebrunner from ${SOURCE_VERSION} to ${TARGET_VERSION}" + +# apply nginx changes + +#apply mcloud changes +if [[ ! -f mcloud/.disabled ]] ; then + cp mcloud/.env mcloud/.env_2.3 + cp mcloud/variables.env mcloud/variables.env_2.3 + + mcloud/zebrunner.sh setup +fi + +#apply jenkins changes +if [[ ! -f jenkins/.disabled ]] ; then + cp jenkins/variables.env jenkins/variables.env_2.3 + jenkins/zebrunner.sh setup +fi + +# apply selenoid changes +if [[ ! -f selenoid/.disabled ]] ; then + cp selenoid/.env selenoid/.env_2.3 + selenoid/zebrunner.sh setup +fi + +echo "Upgrade to ${TARGET_VERSION} finished successfully" + +#remember successfully applied version in settings.env file +export ZBR_VERSION=${TARGET_VERSION} + +#save information about upgraded zebrunner version +export_settings diff --git a/zebrunner.sh b/zebrunner.sh index 6f6d7f29..a56697ed 100755 --- a/zebrunner.sh +++ b/zebrunner.sh @@ -25,7 +25,7 @@ fi export ZBR_INSTALLER=1 - export ZBR_VERSION=2.3 + export ZBR_VERSION=2.4 set_global_settings cp .env.original .env @@ -516,9 +516,15 @@ exit -1 fi + patch/2.4.sh + p2_4=$? + if [[ ${p2_4} -eq 1 ]]; then + echo "ERROR! 2.4 patchset was not applied correctly!" + exit -1 + fi # IMPORTANT! Increment latest verification to new version, i.e. p1_3, p1_4 etc to verify latest upgrade status - if [[ ${p2_3} -eq 2 ]]; then + if [[ ${p2_4} -eq 2 ]]; then echo "No need to restart service as nothing was upgraded." exit -1 fi