Skip to content

Commit 8b62fb2

Browse files
authored
Merge pull request softprops#72 from Veetaha/feat/skip-zipping
Rename SKIP_ZIPPING=1 -> PACKAGE=false
2 parents 4f3bf9c + b9005c8 commit 8b62fb2

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* Put unzipped `boostrap` and `boostrap.debug` files under `target/lambda/${PROFILE}/output/${BIN}` dir
44
to allow for using these artifacts without an intermediate `.zip` file creation step.
5-
* Introduce `$SKIP_ZIPPING` env var. Setting `-e SKIP_ZIPPING=1` prevents `.zip` archive from
5+
* Introduce `$PACKAGE` env var. Setting `-e PACKAGE=false` prevents `.zip` archive from
66
being created and `package` hook from running.
77

88
# 0.2.7-rust-1.44.1

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can pass additional flags to `cargo`, the Rust build tool, by setting the `C
3434

3535
Unzipped `boostrap` and `boostrap.debug` files are always available
3636
under `target/lambda/${PROFILE}/output/${BIN}` dir. If you want only them and don't
37-
need a `.zip` archive (e.g. for when running lambdas locally) pass `-e SKIP_ZIPPING=1`
37+
need a `.zip` archive (e.g. for when running lambdas locally) pass `-e PACKAGE=false`
3838
flag. More on that in [local testing](#-local-testing).
3939

4040
A typical docker run might look like the following.
@@ -91,18 +91,18 @@ Once you've built a Rust lambda function artifact, the `provided` runtime expect
9191
deployments of that artifact to be named "**bootstrap**". The `lambda-rust` docker image
9292
builds a zip file, named after the binary, containing your binary file renamed to "bootstrap" for you, but zip file creation is unnecessary for local development.
9393

94-
In order to prevent the creation of an intermediate `.zip` artifact when testing your lambdas locally, pass `-e SKIP_ZIPPING=1` during the build. After that the necessary
94+
In order to prevent the creation of an intermediate `.zip` artifact when testing your lambdas locally, pass `-e PACKAGE=false` during the build. After that the necessary
9595
output (not zipped) is available under `target/lambda/{profile}/output/{your-lambda-binary-name}` dir.
9696
You will see both `bootstrap` and `bootstrap.debug` files there.
97-
> **⚠️ Note:** `SKIP_ZIPPING=1` prevents `package` hook from running.
97+
> **⚠️ Note:** `PACKAGE=false` prevents `package` hook from running.
9898
9999
You can then invoke this bootstap executable with the lambda-ci docker image for the `provided` AWS lambda runtime with a one off container.
100100

101101
```sh
102102
# Build your function skipping the zip creation step
103103
# You may pass `-e PROFILE=dev` to build using dev profile, but here we use `release`
104104
docker run \
105-
-e SKIP_ZIPPING=1 \
105+
-e PACKAGE=false \
106106
-e BIN={your-binary-name} \
107107
-v ${PWD}:/code \
108108
-v ${HOME}/.cargo/registry:/root/.cargo/registry \

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PACKAGE_HOOK="package"
1010
set -eo pipefail
1111
mkdir -p target/lambda
1212
export PROFILE=${PROFILE:-release}
13+
export PACKAGE=${PACKAGE:-true}
1314
export DEBUGINFO=${DEBUGINFO}
1415
# cargo uses different names for target
1516
# of its build profiles
@@ -64,7 +65,7 @@ function package() {
6465
cp "${file}" "${OUTPUT_FOLDER}/bootstrap"
6566
cp "${file}.debug" "${OUTPUT_FOLDER}/bootstrap.debug" > 2&>/dev/null || true
6667

67-
if [[ -z "$SKIP_ZIPPING" ]]; then
68+
if [[ "$PACKAGE" != "false" ]]; then
6869
zip -j "$file.zip" "${OUTPUT_FOLDER}/bootstrap"
6970
if test -f "$HOOKS_DIR/$PACKAGE_HOOK"; then
7071
echo "Running package hook"

tests/test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ package_all() {
3535
ls target/lambda/release/output/"${1}"/bootstrap.debug 2>&1
3636
}
3737

38-
# test SKIP_ZIPPING=1 flag
39-
compile_without_zipping() {
38+
# test PACKAGE=false flag
39+
compile_without_packaging() {
4040
rm -rf target/lambda/release > /dev/null 2>&1
4141
docker run --rm \
42-
-e SKIP_ZIPPING=1 \
42+
-e PACKAGE=false \
4343
-v "${PWD}":/code \
4444
-v "${HOME}"/.cargo/registry:/root/.cargo/registry \
4545
-v "${HOME}"/.cargo/git:/root/.cargo/git \
@@ -78,7 +78,7 @@ for project in test-func test-multi-func test-func-with-hooks; do
7878

7979
assert "it packages all bins with dev profile" package_all_dev_profile "${bin_name}"
8080

81-
assert "it compiles the binaries without zipping when SKIP_ZIPPING=1" compile_without_zipping "${bin_name}"
81+
assert "it compiles the binaries without zipping when PACKAGE=false" compile_without_packaging "${bin_name}"
8282

8383
assert "it packages all bins" package_all "${bin_name}"
8484

0 commit comments

Comments
 (0)