From 24511f6fab4dffa87e296646141631e6b42f91db Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Fri, 10 May 2024 12:09:39 +0200 Subject: [PATCH] [Tools] Make deploy script able to update the lambda function with local code. --- scripts/deploy.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index c3178d79..a21bcc1c 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -93,12 +93,13 @@ if [[ ! $(aws cloudformation describe-stacks --stack-name "$STACK_NAME" --region CFN_DEPLOY_COMMAND="create-stack" CFN_WAIT_COMMAND="stack-create-complete" CFN_CLI_INPUT_YAML_FILE="$INFRASTRUCTURE_DIR/environments/$ENVIRONMENT-cfn-create-args.yaml" - + UPDATE_LAMBDA="false" else info "The stack $STACK_NAME exists, updating ..." CFN_DEPLOY_COMMAND="update-stack" CFN_WAIT_COMMAND="stack-update-complete" CFN_CLI_INPUT_YAML_FILE="$INFRASTRUCTURE_DIR/environments/$ENVIRONMENT-cfn-update-args.yaml" + UPDATE_LAMBDA="true" fi CLI_INPUT_YAML=$(sed "s#BUCKET_URL_PLACEHOLDER#$BUCKET_URL#g" "$CFN_CLI_INPUT_YAML_FILE") @@ -112,6 +113,13 @@ aws cloudformation wait $CFN_WAIT_COMMAND \ --stack-name "$STACK_NAME" \ --region "$REGION" +info "Stack $STACK_NAME deployed" + +if [[ $UPDATE_LAMBDA == "true" ]]; then + info "Updating Lambda ..." + bash "$CURRENT_DIR/build_and_update_lambda.sh" --stack-name "$STACK_NAME" --region "$REGION" +fi + info "Deployment completed!" # -----------------------------