diff --git a/scripts/setClusterVersion.sh b/scripts/setClusterVersion.sh index f0252da4..2fcfe510 100755 --- a/scripts/setClusterVersion.sh +++ b/scripts/setClusterVersion.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -o pipefail # Meant for testing only !!! @@ -8,5 +9,14 @@ CONGLOMERATE=$1 VERSION=$2 -aws ssm put-parameter --name /cloudbender/${CONGLOMERATE}/kubecontrol/meta/clusterversion --type SecureString --value "$(echo "$VERSION" | base64 -w0)" --overwrite +P="/cloudbender/${CONGLOMERATE}/kubecontrol/meta/clusterversion" +export AWS_DEFAULT_OUTPUT=text + +# First verify we point to an existing clusterVersion +OLD=$(aws ssm get-parameter --name $P --with-decryption --query 'Parameter.Value' | base64 -d) || \ + { echo "Cannot find an existing SSM parameter. Make sure your AWS profile and parameters are correct."; exit 1; } + +echo "Current version: $OLD" +aws ssm put-parameter --name $P --type SecureString --value "$(echo "$VERSION" | base64 -w0)" --overwrite +echo "New version: $VERSION"