Skip to content

Commit

Permalink
CASMTRIAGE-7294 improve cray-drydock version comparison in prerequisi…
Browse files Browse the repository at this point in the history
…tes.sh
  • Loading branch information
leliasen-hpe committed Sep 24, 2024
1 parent 6d15a5c commit db38ff7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions upgrade/scripts/upgrade/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,26 @@ if [[ ${state_recorded} == "0" && $(hostname) == "${PRIMARY_NODE}" ]]; then
# This will only be the case in some CSM 1.6 to CSM 1.6 upgrades.
# It only needs to be checked if cert-manager is not already being upgraded.
if [ "${needs_upgrade}" -eq 0 ]; then
drydock_vers=$(helm get metadata -n loftsman cray-drydock -o json | jq -r '.version')
drydock_vers=$(helm get values -n loftsman cray-drydock | grep version: | sed 's/ *version: //')
major=2
minor=18
patch=4
if [[ $(echo "$drydock_vers" | cut -d. -f1) -eq $major ]] && [[ $(echo "$drydock_vers" | cut -d. -f2) -eq $minor ]] && [[ $(echo "$drydock_vers" | cut -d. -f3) -lt $patch ]]; then
((needs_upgrade += 1))
echo "Cray-drydock version: $drydock_vers is installed and needs to be upgraded. Cray-drydock will be upgraded and the cert-manager namespace will be redeployed."
drydock_major="${drydock_vers%%.*}"
drydock_minor_patch="${drydock_vers#*.}" # temp
drydock_patch="${drydock_minor_patch#*.}"
drydock_minor="${drydock_minor_patch%.*}"
if [ $drydock_major -lt $major ]; then
needs_upgrade=1
elif [ $drydock_major -eq $major ] && [ $drydock_minor -lt $minor ]; then
needs_upgrade=1
elif [ $drydock_major -eq $major ] && [ $drydock_minor -eq $minor ] && [ $drydock_patch -lt $patch ]; then
needs_upgrade=1
elif [[ $drydock_vers == "" ]]; then
((needs_upgrade += 1))
needs_upgrade=1
fi
if [ $needs_upgrade -ne 0 ]; then
echo "cray-drydock version [$drydock_vers] less than $major.$minor.$patch and needs to be upgraded."
echo "Cray-drydock will be upgraded and the cert-manager namespace will be redeployed."
fi
fi

Expand Down

0 comments on commit db38ff7

Please sign in to comment.