-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: rollback workflow * add validation step * rollback github * add npm rollback * add script * that
- Loading branch information
Showing
10 changed files
with
169 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _installAndCacheDependencies | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _githubRollback | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
compute-type: BUILD_GENERAL1_MEDIUM | ||
git-credential-helper: yes | ||
variables: | ||
AWS_DEFAULT_REGION: us-east-1 | ||
AWS_REGION: us-east-1 | ||
CDK_DEFAULT_REGION: us-east-1 | ||
CLI_REGION: us-east-1 | ||
|
||
batch: | ||
fast-fail: false | ||
build-graph: | ||
- identifier: install_dependencies | ||
buildspec: codebuild_specs/install_and_cache_dependencies.yml | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
- identifier: validate_rollback_target_version | ||
buildspec: codebuild_specs/validate_rollback_target_version.yml | ||
depend-on: | ||
- install_dependencies | ||
- identifier: github_rollback | ||
buildspec: codebuild_specs/release_workflows/github_rollback.yml | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- validate_rollback_target_version | ||
- identifier: rollback_npm | ||
buildspec: codebuild_specs/rollback_npm.yml | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- validate_rollback_target_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
git-credential-helper: yes | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _rollbackNpm | ||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _validateRollbackTargetVersion | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { releasesRequest, semverToGithubTag } from './github-common'; | ||
import { join } from 'path'; | ||
|
||
/** | ||
* This function expects a 'version' to already exist. | ||
* The release with proved version is marked as latest. | ||
*/ | ||
const markReleaseAsLatest = async (version: string) => { | ||
const { id: releaseId } = await releasesRequest(join('tags', semverToGithubTag(version))); | ||
const releaseIdStr = (releaseId as number).toString(); | ||
console.log(`Marking release ${version} as latest`); | ||
await releasesRequest(releaseIdStr, { | ||
method: 'PATCH', | ||
body: JSON.stringify({ | ||
prerelease: false, | ||
make_latest: 'true', | ||
}), | ||
}); | ||
}; | ||
|
||
const main = async () => { | ||
const version = process.argv[2].trim(); | ||
await markReleaseAsLatest(version); | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters