From 015f248367fbe0af3f3485d0b2c9185f806a815d Mon Sep 17 00:00:00 2001 From: Mike Graves Date: Wed, 5 Sep 2018 10:43:59 -0400 Subject: [PATCH] Update Lambda publishing step This changes the name of the Lambda deployment package to always be `carbon.zip`. We don't currently have the infrastructure to handle changing Lambda aliases so we'll just overwrite the existing Lambda and let the two week delay in staging/prod cron schedules highlight any issues. Downgrading the Lambda to an older version can be done manually using the deployment instructions in the README. --- README.rst | 2 +- build.sh | 2 +- publish.sh | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 236293e..9a0bbb4 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ If you need to deploy a new package outside of Travis then do the following, *no $ cd carbon $ ./build.sh - $ ./publish.sh + $ ./publish.sh --upload Configuration ^^^^^^^^^^^^^ diff --git a/build.sh b/build.sh index 1ee1ee6..75ec5b3 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ DIST_DIR=dist-aws S3_BUCKET=carbon-deploy LIBAIO_SO=libaio.so.1.0.1 ORACLE_ZIP=instantclient-basiclite-linux.x64-18.3.0.0.0dbru.zip -PACKAGE=carbon-`git rev-parse --short HEAD`.zip +PACKAGE=carbon.zip mkdir -p $BUILD_DIR/lib mkdir -p $DIST_DIR diff --git a/publish.sh b/publish.sh index c771817..087f289 100755 --- a/publish.sh +++ b/publish.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash set -e -PACKAGE=carbon-`git rev-parse --short HEAD`.zip +PACKAGE=carbon.zip S3_BUCKET=carbon-deploy -aws lambda update-function-code --function-name carbon-test --s3-bucket \ - $S3_BUCKET --s3-key $PACKAGE --region us-east-1 +for arg in $@; do + if [ "$arg" = '--upload' ]; then + aws s3 cp "dist-aws/$PACKAGE" "s3://$S3_BUCKET/$PACKAGE" + break + fi +done + +aws lambda update-function-code --function-name mitlib-global-carbon \ + --s3-bucket $S3_BUCKET --s3-key $PACKAGE --region us-east-1