From 8231a32041654d08a7f9174cf5ef42763bfb15b9 Mon Sep 17 00:00:00 2001 From: Dennis Bell Date: Sun, 18 Dec 2022 16:27:43 -0800 Subject: [PATCH] Added upgrade guard (and override mechanism) --- ci/tasks/upgrade.yml | 1 + hooks/check | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ci/tasks/upgrade.yml b/ci/tasks/upgrade.yml index e17aadec..c1bf274a 100644 --- a/ci/tasks/upgrade.yml +++ b/ci/tasks/upgrade.yml @@ -32,3 +32,4 @@ params: BOSH_CLIENT_SECRET: ((bosh.password)) KEEP_STATE: true SECRETS_SEED_DATA: ((secrets_seed_data)) + FORCE_INCOMPATIBLE_UPGRADE: yes diff --git a/hooks/check b/hooks/check index 67567380..a824c649 100755 --- a/hooks/check +++ b/hooks/check @@ -2,7 +2,7 @@ set -ue #Version check -version_check 2.8.5 || exit 1 # TODO: Update to 2.8.6 when released +version_check 2.8.6 || exit 1 # Cloud Config checks ok=yes @@ -45,6 +45,24 @@ if want_feature vsphere; then done fi +version="$(exodus kit_version)" +if [[ -n "${version:-}" ]] ; then + set +e + if ! new_enough "$version" "3.0.0" ; then + describe >&2 "" " #C{[Checking Upgrade from $version]}" + + if ! new_enough "${version}" "2.2.7-rc.0" ; then + describe >&2 " #R{[ERROR]} Please upgrade to at least bosh kit 2.3.0 before upgrading to v3.x.x" + if [[ -n "$FORCE_INCOMPATIBLE_UPGRADE" ]] ; then + describe >&2 " #y{[WARN]} Forcing incompatible upgrade due to FORCE_INCOMPATIBLE_UPGRADE being set" + else + ok=no + fi + fi + fi + set -e +fi + if [[ "$ok" == "yes" ]]; then describe " environment files [#G{OK}]" else