From eca7c06ffa3b9023f491631ace393ef8b6df37ca Mon Sep 17 00:00:00 2001 From: Kamil Sobol Date: Tue, 28 Nov 2023 15:36:28 -0800 Subject: [PATCH] add script --- package.json | 1 + scripts/cloud-rollback.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 scripts/cloud-rollback.sh diff --git a/package.json b/package.json index b96e9a860e4..3ac51bfdebf 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "release-rc-local": "bash -c 'source ./scripts/cloud-release.sh && RCLocal'", "release-rc-beta": "bash -c 'source ./scripts/cloud-release.sh && RCBeta'", "release-rc": "bash -c 'source ./scripts/cloud-release.sh && RCProd'", + "rollback": "./scripts/cloud-rollback.sh", "tagged-release-without-e2e-local": "bash -c 'source ./scripts/cloud-release.sh && TaggedRCLocal'", "tagged-release-without-e2e-beta": "bash -c 'source ./scripts/cloud-release.sh && TaggedRCBeta'", "tagged-release-without-e2e-prod": "bash -c 'source ./scripts/cloud-release.sh && TaggedRCProd'", diff --git a/scripts/cloud-rollback.sh b/scripts/cloud-rollback.sh new file mode 100755 index 00000000000..c8dddaa144d --- /dev/null +++ b/scripts/cloud-rollback.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e + +scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")") +source $scriptDir/.env set + +printf 'What version should I rollback to ? ' +read ROLLBACK_TARGET_VERSION + +mwinit +ada cred update --profile=AmplifyCLIReleaseProd --account=$RELEASE_ACCOUNT_PROD --role=CodebuildRelease --provider=isengard --once +RESULT=$(aws codebuild start-build-batch \ +--profile=AmplifyCLIReleaseProd \ +--region us-east-1 \ +--project-name Rollback \ +--build-timeout-in-minutes-override 60 \ +--source-version "dev" \ +--debug-session-enabled \ +--git-clone-depth-override=1000 \ +--environment-variables-override name=ROLLBACK_TARGET_VERSION,value=$ROLLBACK_TARGET_VERSION,type=PLAINTEXT \ +--query 'buildBatch.id' --output text) + +echo "https://us-east-1.console.aws.amazon.com/codesuite/codebuild/$RELEASE_ACCOUNT_PROD/projects/Rollback/batch/$RESULT?region=us-east-1"