From 7c818e55a43d93a23dc917b0e821d63095c298c2 Mon Sep 17 00:00:00 2001 From: Grant Bartel Date: Tue, 18 Aug 2020 14:19:53 +0000 Subject: [PATCH 1/2] chore: Add publish all Lambda Layers script Adds a shell script which builds and publishes all lambda layers. --- lambda-layers/README.md | 4 ++-- scripts/publish-all-lambda-layers.sh | 36 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 scripts/publish-all-lambda-layers.sh diff --git a/lambda-layers/README.md b/lambda-layers/README.md index 3434e8ac7..670d88f9a 100644 --- a/lambda-layers/README.md +++ b/lambda-layers/README.md @@ -4,8 +4,8 @@ 1. Run `bash ./build-layer.sh ` from the bin directory. The layer name should match the layer's directory name, found in the `layers` directory. 1. Setup your AWS account's credentials. Make sure you are using the account you want to publish the layer into. -1. Run `node ./bin/publish.js ` using the same layer name that you just built. +1. Run `node ./publish.js ` using the same layer name that you just built. 1. Repeat the build and publish steps for any additional layers you need published. -1. Run `node ./bin/write-json.js ...` where you use all the layer names as separate +1. Run `node ./write-ts.js ...` where you use all the layer names as separate parameters. The output of this command is a file that is put in packages/aws-rfdk/lib/core/lambdas that contains JSON with all the Layers' regional ARNs. \ No newline at end of file diff --git a/scripts/publish-all-lambda-layers.sh b/scripts/publish-all-lambda-layers.sh new file mode 100755 index 000000000..94f749b7a --- /dev/null +++ b/scripts/publish-all-lambda-layers.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# This script is meant to build and publish all Lambda Layers using Docker. Its usage is: +# publish-all-lambda-layers.sh + +set -euo pipefail + + +SCRIPT_DIR=$(dirname $0) + +# Switch to the lambda layers directory +cd "$SCRIPT_DIR/../lambda-layers" + +# install and build node packages +yarn +yarn build + +# Find all layers +LAYER_NAMES=$(find ./layers -mindepth 1 -maxdepth 1 -printf "%f\n" -type d) + +# Switch to the bin directory +cd bin +for LAYER in "${LAYER_NAMES[@]}" +do + ./build-layer.sh "${LAYER}" +done + +for LAYER in "${LAYER_NAMES[@]}" +do + node ./publish.js "${LAYER}" +done + +node ./write-ts.js "${LAYER_NAMES[@]}" \ No newline at end of file From 34036ee243cc0aca5ac4f76cb41328736a48d493 Mon Sep 17 00:00:00 2001 From: Grant Bartel Date: Tue, 18 Aug 2020 15:02:11 +0000 Subject: [PATCH 2/2] Added new line to the end of the script --- scripts/publish-all-lambda-layers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish-all-lambda-layers.sh b/scripts/publish-all-lambda-layers.sh index 94f749b7a..f358f8450 100755 --- a/scripts/publish-all-lambda-layers.sh +++ b/scripts/publish-all-lambda-layers.sh @@ -33,4 +33,4 @@ do node ./publish.js "${LAYER}" done -node ./write-ts.js "${LAYER_NAMES[@]}" \ No newline at end of file +node ./write-ts.js "${LAYER_NAMES[@]}"