From bc142b57e358e0ed7b3c5cd478fb66876d8e8e8f Mon Sep 17 00:00:00 2001 From: Robert Fairburn <8029478+rfairburn@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:25:50 -0600 Subject: [PATCH] Update sandbox tool scripts to work right with sandcastle-style tags (#9298) We want the sandcastle branch as a source (but it could be anything we choose), but a vX.Y.Z-A version tag over in the sandbox, so split those into 2 asked variables. --- .../PreProvisioner/lambda/deploy_terraform/main.tf | 2 +- infrastructure/sandbox/tools/upgrade_ecr_ecs.sh | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/infrastructure/sandbox/PreProvisioner/lambda/deploy_terraform/main.tf b/infrastructure/sandbox/PreProvisioner/lambda/deploy_terraform/main.tf index 26963312cd..77a6c342e9 100644 --- a/infrastructure/sandbox/PreProvisioner/lambda/deploy_terraform/main.tf +++ b/infrastructure/sandbox/PreProvisioner/lambda/deploy_terraform/main.tf @@ -157,7 +157,7 @@ resource "helm_release" "main" { set { name = "imageTag" - value = "v4.25.0-1" + value = "v4.25.0-2" } set { diff --git a/infrastructure/sandbox/tools/upgrade_ecr_ecs.sh b/infrastructure/sandbox/tools/upgrade_ecr_ecs.sh index 0417fcd3ae..e8406d5dcc 100755 --- a/infrastructure/sandbox/tools/upgrade_ecr_ecs.sh +++ b/infrastructure/sandbox/tools/upgrade_ecr_ecs.sh @@ -28,12 +28,15 @@ case "$(uname)" in esac # TF_VAR_slack_webhook is redundant, but let's provide a common -# interface. +# interface. Since we tag Sandcastle builds separate from the +# released version, we need the separate ECR_IMAGE_VERSION +# variable. EXPECTED_VARIABLES=( TF_VAR_slack_webhook CLOUDFLARE_API_TOKEN FLEET_VERSION + ECR_IMAGE_VERSION ) for VARIABLE in ${EXPECTED_VARIABLES[@]}; do @@ -41,7 +44,7 @@ for VARIABLE in ${EXPECTED_VARIABLES[@]}; do done FLEET_ECR_REPO="411315989055.dkr.ecr.us-east-2.amazonaws.com" -FLEET_ECR_IMAGE="${FLEET_ECR_REPO:?}/sandbox-prod-eks:${FLEET_VERSION:?}" +FLEET_ECR_IMAGE="${FLEET_ECR_REPO:?}/sandbox-prod-eks:${ECR_IMAGE_VERSION:?}" FLEET_DOCKERHUB_IMAGE="fleetdm/fleet:${FLEET_VERSION:?}" pushd "$(dirname ${0})/.." @@ -56,7 +59,10 @@ docker tag "${FLEET_DOCKERHUB_IMAGE:?}" "${FLEET_ECR_IMAGE:?}" docker push "${FLEET_ECR_IMAGE:?}" # Update the terraform to deploy FLEET_VERSION. Requires gsed on Darwin! -${SED:?} -i '/name = "imageTag"/!b;n;c\ value = "'${FLEET_VERSION:?}'"' PreProvisioner/lambda/deploy_terraform/main.tf +${SED:?} -i '/name = "imageTag"/!b;n;c\ value = "'${ECR_IMAGE_VERSION:?}'"' PreProvisioner/lambda/deploy_terraform/main.tf + +# Before running terraform, clean up the deprovisioner just in case +rm -rf ./JITProvisioner/deprovisioner/deploy_terraform/.terraform terraform init --backend-config=backend-prod.conf