Skip to content

Commit 24866d6

Browse files
authored
Add ARM64 architecture support (#36)
Add ARM64 architecture support
1 parent f9373b3 commit 24866d6

15 files changed

+286
-112
lines changed

package-lock.json

+21-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aws-lambda-ric",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"description": "AWS Lambda Runtime Interface Client for NodeJs",
55
"homepage": "https://github.com/aws/aws-lambda-nodejs-runtime-interface-client",
66
"main": "lib/index.js",

scripts/preinstall.sh

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ else
3131
--prefix "$ARTIFACTS_DIR" \
3232
--disable-shared \
3333
--without-ssl \
34+
--with-pic \
3435
--without-zlib && \
3536
make && \
3637
make install

test/integration/codebuild/buildspec.os.alpine.1.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ batch:
99
static:
1010
ignore-failure: false
1111
env:
12-
type: LINUX_CONTAINER
1312
privileged-mode: true
1413
dynamic:
1514
env:
@@ -28,15 +27,25 @@ phases:
2827
- echo "Extracting and including the Runtime Interface Emulator"
2928
- SCRATCH_DIR=".scratch"
3029
- mkdir "${SCRATCH_DIR}"
31-
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
30+
- ARCHITECTURE=$(arch)
31+
- >
32+
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
33+
RIE="aws-lambda-rie"
34+
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
35+
RIE="aws-lambda-rie-arm64"
36+
else
37+
echo "Architecture $ARCHITECTURE is not currently supported."
38+
exit 1
39+
fi
40+
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
3241
- >
3342
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
3443
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3544
- >
3645
echo "RUN apk add curl" >> \
3746
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3847
- >
39-
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
48+
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
4049
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
4150
- >
4251
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
@@ -61,12 +70,11 @@ phases:
6170
- >
6271
docker run \
6372
--detach \
64-
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
6573
--name "${OS_DISTRIBUTION}-app" \
6674
--network "${OS_DISTRIBUTION}-network" \
6775
--entrypoint="" \
6876
"${IMAGE_TAG}" \
69-
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
77+
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
7078
- sleep 2
7179
- >
7280
docker run \
@@ -82,19 +90,20 @@ phases:
8290
echo "Response: ${actual}"
8391
if [[ "$actual" != "$expected" ]]; then
8492
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
93+
exit -1
94+
fi
95+
finally:
96+
- |
8597
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
8698
echo
87-
docker logs "${OS_DISTRIBUTION}-app"
99+
docker logs "${OS_DISTRIBUTION}-app" || true
88100
echo
89101
echo "---------------------------------------------------"
90102
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
91103
echo
92-
docker logs "${OS_DISTRIBUTION}-tester"
104+
docker logs "${OS_DISTRIBUTION}-tester" || true
93105
echo
94106
echo "---------------------------------------------------"
95-
exit -1
96-
fi
97-
finally:
98107
- echo "Cleaning up..."
99108
- docker stop "${OS_DISTRIBUTION}-app" || true
100109
- docker rm --force "${OS_DISTRIBUTION}-app" || true

test/integration/codebuild/buildspec.os.alpine.2.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ batch:
99
static:
1010
ignore-failure: false
1111
env:
12-
type: LINUX_CONTAINER
1312
privileged-mode: true
1413
dynamic:
1514
env:
@@ -26,15 +25,25 @@ phases:
2625
- echo "Extracting and including the Runtime Interface Emulator"
2726
- SCRATCH_DIR=".scratch"
2827
- mkdir "${SCRATCH_DIR}"
29-
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
28+
- ARCHITECTURE=$(arch)
29+
- >
30+
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
31+
RIE="aws-lambda-rie"
32+
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
33+
RIE="aws-lambda-rie-arm64"
34+
else
35+
echo "Architecture $ARCHITECTURE is not currently supported."
36+
exit 1
37+
fi
38+
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
3039
- >
3140
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
3241
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3342
- >
3443
echo "RUN apk add curl" >> \
3544
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3645
- >
37-
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
46+
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
3847
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3948
- >
4049
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
@@ -59,12 +68,11 @@ phases:
5968
- >
6069
docker run \
6170
--detach \
62-
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
6371
--name "${OS_DISTRIBUTION}-app" \
6472
--network "${OS_DISTRIBUTION}-network" \
6573
--entrypoint="" \
6674
"${IMAGE_TAG}" \
67-
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
75+
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
6876
- sleep 2
6977
- >
7078
docker run \
@@ -80,19 +88,20 @@ phases:
8088
echo "Response: ${actual}"
8189
if [[ "$actual" != "$expected" ]]; then
8290
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
91+
exit -1
92+
fi
93+
finally:
94+
- |
8395
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
8496
echo
85-
docker logs "${OS_DISTRIBUTION}-app"
97+
docker logs "${OS_DISTRIBUTION}-app" || true
8698
echo
8799
echo "---------------------------------------------------"
88100
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
89101
echo
90-
docker logs "${OS_DISTRIBUTION}-tester"
102+
docker logs "${OS_DISTRIBUTION}-tester" || true
91103
echo
92104
echo "---------------------------------------------------"
93-
exit -1
94-
fi
95-
finally:
96105
- echo "Cleaning up..."
97106
- docker stop "${OS_DISTRIBUTION}-app" || true
98107
- docker rm --force "${OS_DISTRIBUTION}-app" || true

test/integration/codebuild/buildspec.os.alpine.3.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ batch:
99
static:
1010
ignore-failure: false
1111
env:
12-
type: LINUX_CONTAINER
1312
privileged-mode: true
1413
dynamic:
1514
env:
@@ -26,15 +25,25 @@ phases:
2625
- echo "Extracting and including the Runtime Interface Emulator"
2726
- SCRATCH_DIR=".scratch"
2827
- mkdir "${SCRATCH_DIR}"
29-
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
28+
- ARCHITECTURE=$(arch)
29+
- >
30+
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
31+
RIE="aws-lambda-rie"
32+
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
33+
RIE="aws-lambda-rie-arm64"
34+
else
35+
echo "Architecture $ARCHITECTURE is not currently supported."
36+
exit 1
37+
fi
38+
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
3039
- >
3140
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
3241
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3342
- >
3443
echo "RUN apk add curl" >> \
3544
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3645
- >
37-
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
46+
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
3847
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3948
- >
4049
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
@@ -59,12 +68,11 @@ phases:
5968
- >
6069
docker run \
6170
--detach \
62-
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
6371
--name "${OS_DISTRIBUTION}-app" \
6472
--network "${OS_DISTRIBUTION}-network" \
6573
--entrypoint="" \
6674
"${IMAGE_TAG}" \
67-
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
75+
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
6876
- sleep 2
6977
- >
7078
docker run \
@@ -80,19 +88,20 @@ phases:
8088
echo "Response: ${actual}"
8189
if [[ "$actual" != "$expected" ]]; then
8290
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
91+
exit -1
92+
fi
93+
finally:
94+
- |
8395
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
8496
echo
85-
docker logs "${OS_DISTRIBUTION}-app"
97+
docker logs "${OS_DISTRIBUTION}-app" || true
8698
echo
8799
echo "---------------------------------------------------"
88100
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
89101
echo
90-
docker logs "${OS_DISTRIBUTION}-tester"
102+
docker logs "${OS_DISTRIBUTION}-tester" || true
91103
echo
92104
echo "---------------------------------------------------"
93-
exit -1
94-
fi
95-
finally:
96105
- echo "Cleaning up..."
97106
- docker stop "${OS_DISTRIBUTION}-app" || true
98107
- docker rm --force "${OS_DISTRIBUTION}-app" || true

test/integration/codebuild/buildspec.os.amazonlinux.yml test/integration/codebuild/buildspec.os.amazonlinux.1.yml

+21-12
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ batch:
99
static:
1010
ignore-failure: false
1111
env:
12-
type: LINUX_CONTAINER
1312
privileged-mode: true
1413
dynamic:
1514
env:
1615
variables:
1716
DISTRO_VERSION:
1817
- "1"
19-
- "2"
2018
RUNTIME_VERSION:
2119
- "10"
2220
- "12"
@@ -28,12 +26,22 @@ phases:
2826
- echo "Extracting and including the Runtime Interface Emulator"
2927
- SCRATCH_DIR=".scratch"
3028
- mkdir "${SCRATCH_DIR}"
31-
- tar -xvf test/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
29+
- ARCHITECTURE=$(arch)
30+
- >
31+
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
32+
RIE="aws-lambda-rie"
33+
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
34+
RIE="aws-lambda-rie-arm64"
35+
else
36+
echo "Architecture $ARCHITECTURE is not currently supported."
37+
exit 1
38+
fi
39+
- tar -xvf test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
3240
- >
3341
cp "test/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
3442
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3543
- >
36-
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
44+
echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \
3745
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3846
- >
3947
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
@@ -49,7 +57,8 @@ phases:
4957
-f "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" \
5058
-t "${IMAGE_TAG}" \
5159
--build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \
52-
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
60+
--build-arg DISTRO_VERSION="${DISTRO_VERSION}" \
61+
--build-arg ARCHITECTURE="${ARCHITECTURE}"
5362
build:
5463
commands:
5564
- set -x
@@ -58,12 +67,11 @@ phases:
5867
- >
5968
docker run \
6069
--detach \
61-
-e "NPX_BINARY_LOCATION=${NPX_BINARY_LOCATION}" \
6270
--name "${OS_DISTRIBUTION}-app" \
6371
--network "${OS_DISTRIBUTION}-network" \
6472
--entrypoint="" \
6573
"${IMAGE_TAG}" \
66-
sh -c '/usr/bin/aws-lambda-rie ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler'
74+
sh -c "/usr/bin/${RIE} ${NPX_BINARY_LOCATION} aws-lambda-ric index.handler"
6775
- sleep 2
6876
- >
6977
docker run \
@@ -79,19 +87,20 @@ phases:
7987
echo "Response: ${actual}"
8088
if [[ "$actual" != "$expected" ]]; then
8189
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
90+
exit -1
91+
fi
92+
finally:
93+
- |
8294
echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
8395
echo
84-
docker logs "${OS_DISTRIBUTION}-app"
96+
docker logs "${OS_DISTRIBUTION}-app" || true
8597
echo
8698
echo "---------------------------------------------------"
8799
echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
88100
echo
89-
docker logs "${OS_DISTRIBUTION}-tester"
101+
docker logs "${OS_DISTRIBUTION}-tester" || true
90102
echo
91103
echo "---------------------------------------------------"
92-
exit -1
93-
fi
94-
finally:
95104
- echo "Cleaning up..."
96105
- docker stop "${OS_DISTRIBUTION}-app" || true
97106
- docker rm --force "${OS_DISTRIBUTION}-app" || true

0 commit comments

Comments
 (0)