Skip to content

Commit ca129d9

Browse files
committed
Keep bootstrap executable after creating the release zipfile
This is convenient for local testing because one can skip the unzipping step before using the `lambci/lambda` image.
1 parent 7e99c0c commit ca129d9

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,10 @@ You can invoke this bootstap executable with the lambda-ci docker image for the
7979
```sh
8080
# start a one-off docker container replicating the "provided" lambda runtime
8181
# awaiting an event to be provided via stdin
82-
$ unzip -o \
83-
target/lambda/release/{your-binary-name}.zip \
84-
-d /tmp/lambda && \
85-
docker run \
82+
$ docker run \
8683
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
8784
--rm \
88-
-v /tmp/lambda:/var/task:ro,delegated \
85+
-v ${PWD}/target/lambda/release:/var/task:ro,delegated \
8986
lambci/lambda:provided
9087

9188
# provide an event payload via stdin (typically a json blob)

build.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,18 @@ export CARGO_TARGET_DIR=$PWD/target/lambda
4949

5050
function package() {
5151
file="$1"
52+
OUTPUT_FOLDER="output"
5253
if [[ "${PROFILE}" == "release" ]] && [[ -z "${DEBUGINFO}" ]]; then
5354
objcopy --only-keep-debug "$file" "$file.debug"
5455
objcopy --strip-debug --strip-unneeded "$file"
5556
objcopy --add-gnu-debuglink="$file.debug" "$file"
5657
fi
5758
rm "$file.zip" > 2&>/dev/null || true
58-
# note: would use printf "@ $(basename $file)\n@=bootstrap" | zipnote -w "$file.zip"
59-
# if not for https://bugs.launchpad.net/ubuntu/+source/zip/+bug/519611
60-
if [ "$file" != ./bootstrap ] && [ "$file" != bootstrap ]; then
61-
mv "${file}" bootstrap
62-
mv "${file}.debug" bootstrap.debug > 2&>/dev/null || true
63-
fi
64-
zip "$file.zip" bootstrap
65-
rm bootstrap
59+
rm -r "${OUTPUT_FOLDER}" > 2&>/dev/null || true
60+
mkdir "${OUTPUT_FOLDER}"
61+
cp "${file}" "${OUTPUT_FOLDER}/bootstrap"
62+
cp "${file}.debug" "${OUTPUT_FOLDER}/bootstrap.debug" > 2&>/dev/null || true
63+
zip -j "$file.zip" "${OUTPUT_FOLDER}/bootstrap"
6664

6765
if test -f "$HOOKS_DIR/$PACKAGE_HOOK"; then
6866
echo "Running package hook"

0 commit comments

Comments
 (0)