-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAC-2372 Implement database migration workflow (#568)
Add run flyway command lambda handler and IaC code Add run flyway command lambda layer files and IaC code Make npm build script build ayer using new build-flyway-layer script as well as lambdas Make checkout actions in deployment tasks in workflows use the lfs flag Add Git LFS to repository in order to store large flyway tar file and redshift driver Extract getSecret functionality and RedshiftSecret type into shared Add tests and test resources for new lambda Simplify parseS3ResponseAsObject lambda and update athena get config test that uses it
- Loading branch information
1 parent
60a53b2
commit d9d7a10
Showing
30 changed files
with
499 additions
and
69 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,2 @@ | ||
*.jar filter=lfs diff=lfs merge=lfs -text | ||
*.tar.gz filter=lfs diff=lfs merge=lfs -text |
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
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ template.yaml | |
reports | ||
iac-dist/ | ||
.vscode | ||
layer-dist/ |
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,3 @@ | ||
# git-lfs hook | ||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } | ||
git lfs post-checkout "$@" |
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,3 @@ | ||
# git-lfs hook | ||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } | ||
git lfs post-commit "$@" |
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,3 @@ | ||
# git-lfs hook | ||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } | ||
git lfs post-merge "$@" |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
npm run test | ||
|
||
# git-lfs hook | ||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } | ||
git lfs pre-push "$@" |
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 |
---|---|---|
|
@@ -8,3 +8,6 @@ test-report/ | |
.husky/ | ||
*.properties | ||
Dockerfile | ||
*.sql | ||
*.jar | ||
*.tar.gz |
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
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 @@ | ||
CREATE TABLE hello (id int); |
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,36 @@ | ||
#!/bin/bash -e | ||
|
||
ROOT=$(pwd) | ||
LAYER_DIST="$ROOT/layer-dist/flyway" | ||
LAYER_SRC="$ROOT/src/layers/flyway" | ||
BIN_DIR="$LAYER_DIST"/bin | ||
FLYWAY_DIR="$LAYER_DIST"/flyway | ||
|
||
rm -rf "$ROOT/layer-dist" | ||
mkdir -p "$BIN_DIR" | ||
mkdir -p "$FLYWAY_DIR" | ||
|
||
echo "Building layers/flyway" | ||
|
||
cp -R "$LAYER_SRC"/run-flyway "$BIN_DIR" | ||
|
||
tar -xzf "$LAYER_SRC"/flyway-commandline-*-linux-x64.tar.gz -C "$FLYWAY_DIR" --strip-components 1 | ||
|
||
# delete almost everything in drivers/ to reduce the size of the lambda so it will fit within the AWS deployment package limit | ||
# see https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html | ||
mv "$FLYWAY_DIR"/drivers/jackson-data*.jar "$LAYER_DIST" | ||
rm -r "$FLYWAY_DIR"/drivers/* | ||
mv "$LAYER_DIST"/jackson-data*.jar "$FLYWAY_DIR"/drivers | ||
|
||
# add redshift driver | ||
cp "$LAYER_SRC"/redshift-jdbc*.jar "$FLYWAY_DIR"/drivers | ||
|
||
# further reduce package size by deleting a large and apparently unneeded directory from lib/ | ||
rm -rf "$FLYWAY_DIR"/lib/rgcompare | ||
|
||
# remove jre/legal/ as it is full of broken symlinks that cause sam deploy to exit with an error | ||
rm -rf "$FLYWAY_DIR"/jre/legal | ||
|
||
# add migrations | ||
mkdir -p "$FLYWAY_DIR"/sql | ||
cp redshift-scripts/migrations/*.sql "$FLYWAY_DIR"/sql |
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
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
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
Oops, something went wrong.