diff --git a/Makefile b/Makefile index 57db742..83ab852 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/README.md b/README.md index f7821d0..f5e3742 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/lib/aws_lambda_ric/version.rb b/lib/aws_lambda_ric/version.rb index 40f8aec..fc0d761 100644 --- a/lib/aws_lambda_ric/version.rb +++ b/lib/aws_lambda_ric/version.rb @@ -3,5 +3,5 @@ # frozen_string_literal: true module AwsLambdaRuntimeInterfaceClient - VERSION = '1.0.2' + VERSION = '2.0.0' end diff --git a/test/integration/codebuild/buildspec.os.alpine.1.yml b/test/integration/codebuild/buildspec.os.alpine.1.yml new file mode 100644 index 0000000..361def0 --- /dev/null +++ b/test/integration/codebuild/buildspec.os.alpine.1.yml @@ -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 diff --git a/test/integration/codebuild/buildspec.os.alpine.yml b/test/integration/codebuild/buildspec.os.alpine.2.yml similarity index 82% rename from test/integration/codebuild/buildspec.os.alpine.yml rename to test/integration/codebuild/buildspec.os.alpine.2.yml index a2e7b89..9c9a9d3 100644 --- a/test/integration/codebuild/buildspec.os.alpine.yml +++ b/test/integration/codebuild/buildspec.os.alpine.2.yml @@ -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" @@ -29,7 +27,17 @@ 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" @@ -37,7 +45,7 @@ phases: 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}" ]]; @@ -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 \ @@ -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 diff --git a/test/integration/codebuild/buildspec.os.amazonlinux.yml b/test/integration/codebuild/buildspec.os.amazonlinux.yml index 66d095a..08176ce 100644 --- a/test/integration/codebuild/buildspec.os.amazonlinux.yml +++ b/test/integration/codebuild/buildspec.os.amazonlinux.yml @@ -10,7 +10,6 @@ batch: static: ignore-failure: false env: - type: LINUX_CONTAINER privileged-mode: true dynamic: env: @@ -21,6 +20,7 @@ batch: - "2.5" - "2.6" - "2.7" + - "3.0" phases: pre_build: commands: @@ -28,12 +28,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}" ]]; @@ -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 \ @@ -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 diff --git a/test/integration/codebuild/buildspec.os.centos.yml b/test/integration/codebuild/buildspec.os.centos.yml index 5932ea5..02ff80b 100644 --- a/test/integration/codebuild/buildspec.os.centos.yml +++ b/test/integration/codebuild/buildspec.os.centos.yml @@ -10,7 +10,6 @@ batch: static: ignore-failure: false env: - type: LINUX_CONTAINER privileged-mode: true dynamic: env: @@ -22,6 +21,7 @@ batch: - "2.7" - "2.6" - "2.5" + - "3.0" phases: pre_build: commands: @@ -29,12 +29,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}" ]]; @@ -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 \ @@ -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 diff --git a/test/integration/codebuild/buildspec.os.debian.yml b/test/integration/codebuild/buildspec.os.debian.yml index b1e5b13..8140558 100644 --- a/test/integration/codebuild/buildspec.os.debian.yml +++ b/test/integration/codebuild/buildspec.os.debian.yml @@ -10,7 +10,6 @@ batch: static: ignore-failure: false env: - type: LINUX_CONTAINER privileged-mode: true dynamic: env: @@ -21,6 +20,7 @@ batch: - "2.5" - "2.6" - "2.7" + - "3.0" phases: pre_build: commands: @@ -28,12 +28,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}" ]]; @@ -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 \ @@ -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 diff --git a/test/integration/codebuild/buildspec.os.ubuntu.yml b/test/integration/codebuild/buildspec.os.ubuntu.yml index 782161f..2335ec4 100644 --- a/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -10,7 +10,6 @@ batch: static: ignore-failure: false env: - type: LINUX_CONTAINER privileged-mode: true dynamic: env: @@ -22,6 +21,7 @@ batch: - "2.7" - "2.6" - "2.5" + - "3.0" phases: pre_build: commands: @@ -29,7 +29,17 @@ 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" @@ -37,7 +47,7 @@ phases: echo "RUN apt-get install -y 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}" ]]; @@ -62,12 +72,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 \ @@ -83,19 +92,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 diff --git a/test/integration/docker/Dockerfile.echo.amazonlinux b/test/integration/docker/Dockerfile.echo.amazonlinux index 3232867..c7261ca 100644 --- a/test/integration/docker/Dockerfile.echo.amazonlinux +++ b/test/integration/docker/Dockerfile.echo.amazonlinux @@ -15,7 +15,8 @@ ENV PATH="/root/.rbenv/bin:$PATH" RUN echo 'eval "$(rbenv init -)"' >> /root/.bashrc RUN git clone git://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build RUN source /root/.bashrc -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+" | sed "s/\\./\\\./1")) && \ +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ rbenv install -v ${RUNTIME_LATEST_VERSION} && \ rbenv global ${RUNTIME_LATEST_VERSION} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ @@ -44,7 +45,8 @@ ENV PATH="/root/.rbenv/bin:$PATH" # Copy the Runtime Interface Client gem and install it ARG RIC_BUILD_DIR="/build" COPY --from=build-image ${RIC_BUILD_DIR}/pkg/aws_lambda_ric*.gem aws_lambda_ric.gem -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+$" | sed "s/\\./\\\./1")) && \ +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ gem install aws_lambda_ric.gem && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/aws_lambda_ric /usr/local/bin/aws_lambda_ric diff --git a/test/integration/docker/Dockerfile.echo.centos b/test/integration/docker/Dockerfile.echo.centos index 597ad07..9f588ef 100644 --- a/test/integration/docker/Dockerfile.echo.centos +++ b/test/integration/docker/Dockerfile.echo.centos @@ -15,7 +15,8 @@ ENV PATH="/root/.rbenv/bin:$PATH" RUN echo 'eval "$(rbenv init -)"' >> /root/.bashrc RUN git clone git://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build RUN source /root/.bashrc -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+$" | sed "s/\\./\\\./1")) && \ +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ rbenv install -v ${RUNTIME_LATEST_VERSION} && \ rbenv global ${RUNTIME_LATEST_VERSION} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ @@ -44,7 +45,8 @@ ENV PATH="/root/.rbenv/bin:$PATH" # Copy the Runtime Interface Client gem and install it ARG RIC_BUILD_DIR="/build" COPY --from=build-image ${RIC_BUILD_DIR}/pkg/aws_lambda_ric*.gem aws_lambda_ric.gem -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+" | sed "s/\\./\\\./1")) && \ +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ gem install aws_lambda_ric.gem && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/aws_lambda_ric /usr/local/bin/aws_lambda_ric diff --git a/test/integration/docker/Dockerfile.echo.ubuntu b/test/integration/docker/Dockerfile.echo.ubuntu index 483d754..e79d335 100644 --- a/test/integration/docker/Dockerfile.echo.ubuntu +++ b/test/integration/docker/Dockerfile.echo.ubuntu @@ -11,7 +11,7 @@ ARG RUNTIME_VERSION RUN apt-get update -y && \ apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev libtool - +RUN ln -sf /bin/bash /bin/sh RUN rm -rf /root/.rbenv/ RUN git clone git://github.com/sstephenson/rbenv.git /root/.rbenv ENV PATH="/root/.rbenv/bin:$PATH" @@ -19,7 +19,8 @@ RUN echo 'eval "$(rbenv init -)"' >> /root/.bashrc RUN git clone git://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build RUN bash /root/.bashrc -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+" | sed "s/\\./\\\./1")) && \ +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ rbenv install -v ${RUNTIME_LATEST_VERSION} && \ rbenv global ${RUNTIME_LATEST_VERSION} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ @@ -53,10 +54,13 @@ ENV PATH="/root/.rbenv/bin:$PATH" # Copy the Runtime Interface Client gem and install it ARG RIC_BUILD_DIR="/build" COPY --from=build-image ${RIC_BUILD_DIR}/pkg/aws_lambda_ric*.gem aws_lambda_ric.gem -RUN RUNTIME_LATEST_VERSION=$(rbenv install -l | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+$" | sed "s/\\./\\\./1")) && \ +RUN ln -sf /bin/bash /bin/sh +RUN RUNTIME_VERSIONS=($(rbenv install -L | grep -oE $(echo "^${RUNTIME_VERSION}\.[0-9]+"))) && \ + RUNTIME_LATEST_VERSION=${RUNTIME_VERSIONS[-1]} && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/gem /usr/local/bin/gem && \ gem install aws_lambda_ric.gem && \ cp /root/.rbenv/versions/${RUNTIME_LATEST_VERSION}/bin/aws_lambda_ric /usr/local/bin/aws_lambda_ric + ARG FUNCTION_DIR="/function" RUN mkdir -p ${FUNCTION_DIR} diff --git a/test/integration/resources/aws-lambda-rie-arm64.tar.gz b/test/integration/resources/aws-lambda-rie-arm64.tar.gz new file mode 100644 index 0000000..f62577f Binary files /dev/null and b/test/integration/resources/aws-lambda-rie-arm64.tar.gz differ diff --git a/test/unit/resources/runtime_handlers/Gemfile b/test/unit/resources/runtime_handlers/Gemfile new file mode 100644 index 0000000..cf4a19c --- /dev/null +++ b/test/unit/resources/runtime_handlers/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'activesupport', '~> 6.0.1'