Make setClusterVersion less brittle

This commit is contained in:
Stefan Reimer 2021-03-19 10:15:15 +01:00
parent 419d43cf9f
commit ef5fa96ec8

View File

@ -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"