Skip to content

Add ARM64 architecture support #17

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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup-codebuild-agent:

.PHONY: test-smoke
test-smoke: setup-codebuild-agent
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.12 2.7
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.1.yml alpine 3.12 2.7

.PHONY: test-unit
test-unit:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,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 lib/aws_lambda_ric/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# frozen_string_literal: true

module AwsLambdaRuntimeInterfaceClient
VERSION = '1.0.2'
VERSION = '2.0.0'
end
113 changes: 113 additions & 0 deletions test/integration/codebuild/buildspec.os.alpine.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
version: 0.2

env:
variables:
OS_DISTRIBUTION: alpine
EXECUTABLE: "/usr/local/bundle/bin/aws_lambda_ric"
TEST_NAME: "aws-lambda-ruby-ric-alpine-test"
batch:
build-matrix:
static:
ignore-failure: false
env:
privileged-mode: true
dynamic:
env:
variables:
DISTRO_VERSION:
- "3.12"
RUNTIME_VERSION:
- "2.5"
- "2.6"
- "2.7"
- "3.0"
phases:
pre_build:
commands:
- export IMAGE_TAG="ruby-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}"
- echo "Extracting and including the Runtime Interface Emulator"
- SCRATCH_DIR=".scratch"
- mkdir "${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}/${RIE} /usr/bin/${RIE}" >> \
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
then
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
else
echo "Performing DockerHub login . . ."
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
fi
- echo "Building image ${IMAGE_TAG}"
- >
docker build . \
-f "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" \
-t "${IMAGE_TAG}" \
--build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${TEST_NAME}-network"
- >
docker run \
--detach \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} "${EXECUTABLE}" "app.App::Handler.process""
- sleep 2
- >
docker run \
--name "${TEST_NAME}-tester" \
--env "TARGET=${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${TEST_NAME}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
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
- docker stop "${TEST_NAME}-tester" || true
- docker rm --force "${TEST_NAME}-tester" || true
- docker network rm "${TEST_NAME}-network" || true
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:
- "3.11"
- "3.12"
RUNTIME_VERSION:
- "2.5"
- "2.6"
Expand All @@ -29,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 @@ -62,12 +70,11 @@ phases:
- >
docker run \
--detach \
--env "EXECUTABLE=${EXECUTABLE}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie "${EXECUTABLE}" "app.App::Handler.process"'
sh -c "/usr/bin/${RIE} "${EXECUTABLE}" "app.App::Handler.process""
- sleep 2
- >
docker run \
Expand All @@ -83,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: ${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
fi
finally:
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
30 changes: 20 additions & 10 deletions test/integration/codebuild/buildspec.os.amazonlinux.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 @@ -21,19 +20,30 @@ batch:
- "2.5"
- "2.6"
- "2.7"
- "3.0"
phases:
pre_build:
commands:
- export IMAGE_TAG="ruby-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}"
- 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 @@ -58,12 +68,11 @@ phases:
- >
docker run \
--detach \
--env "EXECUTABLE=${EXECUTABLE}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie "${EXECUTABLE}" "app.App::Handler.process"'
sh -c "/usr/bin/${RIE} "${EXECUTABLE}" "app.App::Handler.process""
- sleep 2
- >
docker run \
Expand All @@ -79,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: ${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
fi
finally:
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
30 changes: 20 additions & 10 deletions test/integration/codebuild/buildspec.os.centos.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 @@ -22,19 +21,30 @@ batch:
- "2.7"
- "2.6"
- "2.5"
- "3.0"
phases:
pre_build:
commands:
- export IMAGE_TAG="ruby-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}"
- 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 @@ -59,12 +69,11 @@ phases:
- >
docker run \
--detach \
--env "EXECUTABLE=${EXECUTABLE}" \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c '/usr/bin/aws-lambda-rie "${EXECUTABLE}" "app.App::Handler.process"'
sh -c "/usr/bin/${RIE} "${EXECUTABLE}" "app.App::Handler.process""
- sleep 2
- >
docker run \
Expand All @@ -80,19 +89,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: ${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
fi
finally:
- echo "Cleaning up..."
- docker stop "${TEST_NAME}-app" || true
- docker rm --force "${TEST_NAME}-app" || true
Expand Down
Loading