Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add publish all Lambda Layers script #67

Merged
merged 2 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lambda-layers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
1. Run `bash ./build-layer.sh <layer_name>` 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 <layer_name>` using the same layer name that you just built.
1. Run `node ./publish.js <layer_name>` 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 <layer_name> ...` where you use all the layer names as separate
1. Run `node ./write-ts.js <layer_name> ...` 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.
36 changes: 36 additions & 0 deletions scripts/publish-all-lambda-layers.sh
Original file line number Diff line number Diff line change
@@ -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[@]}"