Skip to content

Add ARM64 architecture support #36

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

Merged
merged 2 commits into from
Sep 29, 2021
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
33 changes: 21 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-lambda-ric",
"version": "1.1.0",
"version": "2.0.0",
"description": "AWS Lambda Runtime Interface Client for NodeJs",
"homepage": "https://github.com/aws/aws-lambda-nodejs-runtime-interface-client",
"main": "lib/index.js",
Expand Down
1 change: 1 addition & 0 deletions scripts/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ else
--prefix "$ARTIFACTS_DIR" \
--disable-shared \
--without-ssl \
--with-pic \
--without-zlib && \
make && \
make install
Expand Down
29 changes: 19 additions & 10 deletions test/integration/codebuild/buildspec.os.alpine.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -28,15 +27,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
- ARCHITECTURE=$(arch)
- >
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
RIE="aws-lambda-rie"
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
RIE="aws-lambda-rie-arm64"
else
echo "Architecture $ARCHITECTURE is not currently supported."
exit 1
fi
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "RUN apk add curl" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
Expand All @@ -61,12 +70,11 @@ phases:
- >
docker run \
--detach \
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
- sleep 2
- >
docker run \
Expand All @@ -82,19 +90,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
echo
docker logs "${OS_DISTRIBUTION}-app"
docker logs "${OS_DISTRIBUTION}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
echo
docker logs "${OS_DISTRIBUTION}-tester"
docker logs "${OS_DISTRIBUTION}-tester" || true
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- echo "Cleaning up..."
- docker stop "${OS_DISTRIBUTION}-app" || true
- docker rm --force "${OS_DISTRIBUTION}-app" || true
Expand Down
29 changes: 19 additions & 10 deletions test/integration/codebuild/buildspec.os.alpine.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -26,15 +25,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
- ARCHITECTURE=$(arch)
- >
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
RIE="aws-lambda-rie"
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
RIE="aws-lambda-rie-arm64"
else
echo "Architecture $ARCHITECTURE is not currently supported."
exit 1
fi
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "RUN apk add curl" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
Expand All @@ -59,12 +68,11 @@ phases:
- >
docker run \
--detach \
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
- sleep 2
- >
docker run \
Expand All @@ -80,19 +88,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
echo
docker logs "${OS_DISTRIBUTION}-app"
docker logs "${OS_DISTRIBUTION}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
echo
docker logs "${OS_DISTRIBUTION}-tester"
docker logs "${OS_DISTRIBUTION}-tester" || true
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- echo "Cleaning up..."
- docker stop "${OS_DISTRIBUTION}-app" || true
- docker rm --force "${OS_DISTRIBUTION}-app" || true
Expand Down
29 changes: 19 additions & 10 deletions test/integration/codebuild/buildspec.os.alpine.3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -26,15 +25,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
- ARCHITECTURE=$(arch)
- >
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
RIE="aws-lambda-rie"
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
RIE="aws-lambda-rie-arm64"
else
echo "Architecture $ARCHITECTURE is not currently supported."
exit 1
fi
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "RUN apk add curl" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
Expand All @@ -59,12 +68,11 @@ phases:
- >
docker run \
--detach \
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
- sleep 2
- >
docker run \
Expand All @@ -80,19 +88,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
echo
docker logs "${OS_DISTRIBUTION}-app"
docker logs "${OS_DISTRIBUTION}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
echo
docker logs "${OS_DISTRIBUTION}-tester"
docker logs "${OS_DISTRIBUTION}-tester" || true
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- echo "Cleaning up..."
- docker stop "${OS_DISTRIBUTION}-app" || true
- docker rm --force "${OS_DISTRIBUTION}-app" || true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
variables:
DISTRO_VERSION:
- "1"
- "2"
RUNTIME_VERSION:
- "10"
- "12"
Expand All @@ -28,12 +26,22 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
- ARCHITECTURE=$(arch)
- >
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
RIE="aws-lambda-rie"
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
RIE="aws-lambda-rie-arm64"
else
echo "Architecture $ARCHITECTURE is not currently supported."
exit 1
fi
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
Expand All @@ -49,7 +57,8 @@ phases:
-f "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" \
-t "${IMAGE_TAG}" \
--build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
--build-arg DISTRO_VERSION="${DISTRO_VERSION}" \
--build-arg ARCHITECTURE="${ARCHITECTURE}"
build:
commands:
- set -x
Expand All @@ -58,12 +67,11 @@ phases:
- >
docker run \
--detach \
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
- sleep 2
- >
docker run \
Expand All @@ -79,19 +87,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
echo
docker logs "${OS_DISTRIBUTION}-app"
docker logs "${OS_DISTRIBUTION}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
echo
docker logs "${OS_DISTRIBUTION}-tester"
docker logs "${OS_DISTRIBUTION}-tester" || true
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- echo "Cleaning up..."
- docker stop "${OS_DISTRIBUTION}-app" || true
- docker rm --force "${OS_DISTRIBUTION}-app" || true
Expand Down
Loading