Skip to content

Add ARM64 architecture support #59

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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ If you discover a potential security issue in this project we ask that you notif

## License

This project is licensed under the Apache-2.0 License.
This project is licensed under the Apache-2.0 License.
2 changes: 1 addition & 1 deletion awslambdaric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""

__version__ = "1.2.2"
__version__ = "2.0.0"
1 change: 1 addition & 0 deletions scripts/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ else
--prefix "$ARTIFACTS_DIR" \
--disable-shared \
--without-ssl \
--with-pic \
--without-zlib && \
make && \
make install
Expand Down
39 changes: 24 additions & 15 deletions tests/integration/codebuild/buildspec.os.alpine.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -27,15 +26,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf tests/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 tests/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "tests/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 @@ -60,12 +69,11 @@ phases:
- >
docker run \
--detach \
-e "PYTHON_LOCATION=${PYTHON_LOCATION}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${PYTHON_LOCATION} -m awslambdaric app.handler'
sh -c "/usr/bin/${RIE} ${PYTHON_LOCATION} -m awslambdaric app.handler"
- sleep 2
- >
docker run \
Expand All @@ -81,19 +89,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app"
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester"
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester" || true
echo
echo "---------------------------------------------------"
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
39 changes: 24 additions & 15 deletions tests/integration/codebuild/buildspec.os.alpine.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -29,15 +28,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf tests/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 tests/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "tests/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 @@ -62,12 +71,11 @@ phases:
- >
docker run \
--detach \
-e "PYTHON_LOCATION=${PYTHON_LOCATION}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${PYTHON_LOCATION} -m awslambdaric app.handler'
sh -c "/usr/bin/${RIE} ${PYTHON_LOCATION} -m awslambdaric app.handler"
- sleep 2
- >
docker run \
Expand All @@ -83,19 +91,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app"
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester"
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester" || true
echo
echo "---------------------------------------------------"
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
39 changes: 24 additions & 15 deletions tests/integration/codebuild/buildspec.os.alpine.3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
Expand All @@ -29,15 +28,25 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- tar -xvf tests/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 tests/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "tests/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 @@ -62,12 +71,11 @@ phases:
- >
docker run \
--detach \
-e "PYTHON_LOCATION=${PYTHON_LOCATION}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie ${PYTHON_LOCATION} -m awslambdaric app.handler'
sh -c "/usr/bin/${RIE} ${PYTHON_LOCATION} -m awslambdaric app.handler"
- sleep 2
- >
docker run \
Expand All @@ -83,19 +91,20 @@ phases:
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app"
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester"
echo
echo "---------------------------------------------------"
exit -1
fi
finally:
- |
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester" || true
echo
echo "---------------------------------------------------"
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ batch:
static:
ignore-failure: false
env:
type: LINUX_CONTAINER
privileged-mode: true
dynamic:
env:
variables:
DISTRO_VERSION:
- "1"
- "2"
RUNTIME_VERSION:
- "3.6"
- "3.7"
Expand All @@ -30,6 +28,7 @@ phases:
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${SCRATCH_DIR}"
- ARCHITECTURE=$(arch)
- tar -xvf tests/integration/resources/aws-lambda-rie.tar.gz --directory "${SCRATCH_DIR}"
- >
cp "tests/integration/docker/Dockerfile.echo.${OS_DISTRIBUTION}" \
Expand All @@ -51,7 +50,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 Down Expand Up @@ -83,12 +83,12 @@ phases:
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
echo "---------Container Logs: ${TEST_NAME}-app----------"
echo
docker logs "${TEST_NAME}-app"
docker logs "${TEST_NAME}-app" || true
echo
echo "---------------------------------------------------"
echo "--------Container Logs: ${TEST_NAME}-tester--------"
echo
docker logs "${TEST_NAME}-tester"
docker logs "${TEST_NAME}-tester" || true
echo
echo "---------------------------------------------------"
exit -1
Expand Down
Loading