From 3b467e96d1da7d892e0fefc8da128878c97a7d5f Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 20 Oct 2026 18:11:54 +0000 Subject: [PATCH 01/13] ci: moving integration tests on codebuild runners --- .../workflows/runtime-interface-client_pr.yml | 154 ++++++++----- .../Makefile | 55 +++-- .../codebuild-local/Dockerfile.agent | 31 --- .../codebuild-local/codebuild_build.sh | 206 ------------------ .../integration/codebuild-local/test_all.sh | 88 -------- .../integration/codebuild-local/test_one.sh | 80 ------- .../codebuild/buildspec.os.alpine.yml | 47 +--- .../codebuild/buildspec.os.amazoncorretto.yml | 44 +--- .../codebuild/buildspec.os.amazonlinux.1.yml | 35 +-- .../codebuild/buildspec.os.amazonlinux.2.yml | 44 +--- .../codebuild/buildspec.os.debian.yml | 47 +--- .../codebuild/buildspec.os.ubuntu.yml | 47 +--- .../scripts/configure_multi_arch_env.sh | 2 +- .../scripts}/docker-retry.sh | 0 .../codebuild/scripts/run_all_os_tests.sh | 37 ++++ .../codebuild/scripts/run_invocation_test.sh | 11 +- .../codebuild/scripts/run_os_test.sh | 114 ++++++++++ .../docker/Dockerfile.function.alpine | 3 +- .../docker/Dockerfile.function.amazoncorretto | 3 +- .../docker/Dockerfile.function.amazonlinux | 3 +- .../docker/Dockerfile.function.debian | 5 +- .../docker/Dockerfile.function.ubuntu | 5 +- .../test/integration/os-test-matrix.json | 10 + 23 files changed, 312 insertions(+), 759 deletions(-) delete mode 100644 aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/Dockerfile.agent delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/codebuild_build.sh delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_all.sh delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_one.sh rename aws-lambda-java-runtime-interface-client/test/integration/{codebuild-local => codebuild/scripts}/docker-retry.sh (100%) create mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh create mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh create mode 100644 aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 885b952c7..ba4c0edf6 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -15,17 +15,37 @@ permissions: jobs: + # Smoke and integration tests build and run containers, so they run on + # CodeBuild-hosted runners (projects aws-lambda-java-libs-pr-integ-, + # defined in LambdaRuntimeApiClientsCdk). Image pulls from GitHub-hosted + # runners share IPs with other tenants and hit the public.ecr.aws anonymous + # data limit; pulls from CodeBuild are not capped. + # + # They are skipped on fork PRs: those runners run in our AWS account. On a + # fork PR the smoke-test and integration-test checks pass with a notice, and + # a maintainer must run the tests before merging by pushing the fork's + # commits to a branch here. This `if` only saves a run; the security boundary + # is the repository setting that requires maintainer approval before any fork + # workflow runs. smoke-test-arch: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository strategy: fail-fast: true matrix: - include: - - arch: x86_64 - runner: ubuntu-latest - - arch: aarch64 - runner: ubuntu-24.04-arm - runs-on: ${{ matrix.runner }} - name: "smoke-test (${{ matrix.arch }})" + arch: + - name: x86_64 + runner: x86_64 + - name: aarch64 + runner: arm64 + runs-on: codebuild-aws-lambda-java-libs-pr-integ-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} + name: "smoke-test (${{ matrix.arch.name }})" + # ECR pull-through cache for the base images, as in the release workflow. + # ECR_REGISTRY is the login target; BASE_REGISTRY (with the /ecr-public + # prefix) is read by the JNI build and by run_os_test.sh. + env: + AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} + ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com + BASE_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com/ecr-public steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 @@ -36,19 +56,15 @@ jobs: distribution: corretto cache: maven - - name: Build and install core dependency locally - working-directory: ./aws-lambda-java-core - run: mvn clean install - - - name: Build and install serialization dependency locally - working-directory: ./aws-lambda-java-serialization - run: mvn clean install + # Uses the runner role's ambient credentials. + - name: Log in to Amazon ECR (pull-through cache) + run: | + aws ecr get-login-password --region "$AWS_REGION" \ + | docker login --username AWS --password-stdin "$ECR_REGISTRY" - - name: Runtime Interface Client smoke tests - Run 'pr-${{ matrix.arch }}' target + - name: Runtime Interface Client smoke tests - Run 'pr-${{ matrix.arch.name }}' target working-directory: ./aws-lambda-java-runtime-interface-client - run: make pr-${{ matrix.arch }} - env: - IS_JAVA_8: true + run: make pr-${{ matrix.arch.name }} build-arch: strategy: @@ -106,51 +122,65 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # The OS matrix lives in test/integration/os-test-matrix.json so that + # `make test-integ` runs the same combinations locally. + load-integration-test-matrix: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.load.outputs.matrix }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - name: Load OS test matrix + id: load + run: | + MATRIX=$(jq -c '{include: [.[] | .platforms[] as $p | {os, distro, runtime, platform: $p, + runner: (if $p == "linux/amd64" then "x86_64" else "arm64" end), + label: (if $p == "linux/amd64" then "x64" else "arm64" end)}]}' \ + aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json) + echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" + integration-test-matrix: - runs-on: ${{ matrix.arch.runner }} + needs: load-integration-test-matrix + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: codebuild-aws-lambda-java-libs-pr-integ-${{ matrix.runner }}-${{ github.run_id }}-${{ github.run_attempt }} strategy: # Run every OS/arch combination to completion so one failure doesn't mask the others. fail-fast: false - # Every shard pulls its images anonymously from public.ecr.aws, and shards - # started together trip its rate limit (429), so cap how many run at once. - max-parallel: 4 - matrix: - buildspec: - - buildspec.os.alpine.yml - - buildspec.os.amazoncorretto.yml - - buildspec.os.amazonlinux.1.yml - - buildspec.os.amazonlinux.2.yml - - buildspec.os.debian.yml - - buildspec.os.ubuntu.yml - arch: - - label: x64 - runner: ubuntu-latest - platform: linux/amd64 - - label: arm64 - runner: ubuntu-24.04-arm - platform: linux/arm64/v8 - exclude: - # Amazon Linux 1 was never published for ARM64 (x86_64 only), so - # public.ecr.aws/amazonlinux/amazonlinux:1 has no arm64 manifest. - - buildspec: buildspec.os.amazonlinux.1.yml - arch: - label: arm64 - runner: ubuntu-24.04-arm - platform: linux/arm64/v8 - name: "integration-test (${{ matrix.buildspec }} / ${{ matrix.arch.label }})" + # Stay well inside the account's concurrent CodeBuild build quota. + max-parallel: 8 + matrix: ${{ fromJson(needs.load-integration-test-matrix.outputs.matrix) }} + name: "integration-test (${{ matrix.os }} ${{ matrix.distro }} / ${{ matrix.label }})" + # ECR pull-through cache for the base images, as in the release workflow. + # ECR_REGISTRY is the login target; BASE_REGISTRY (with the /ecr-public + # prefix) is read by the JNI build and by run_os_test.sh. + env: + AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} + ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com + BASE_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com/ecr-public steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 + - name: Set up JDK 1.8 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: - install: true + java-version: 8 + distribution: corretto + cache: maven - - name: Run OS integration test - 'test-integ' target - working-directory: ./aws-lambda-java-runtime-interface-client - run: make test-integ BUILDSPEC=test/integration/codebuild/${{ matrix.buildspec }} + # Uses the runner role's ambient credentials. + - name: Log in to Amazon ECR (pull-through cache) + run: | + aws ecr get-login-password --region "$AWS_REGION" \ + | docker login --username AWS --password-stdin "$ECR_REGISTRY" + + - name: Run OS integration test + run: aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh env: - PLATFORM_FILTER: ${{ matrix.arch.platform }} + OS_DISTRIBUTION: ${{ matrix.os }} + DISTRO_VERSION: ${{ matrix.distro }} + RUNTIME_VERSION: ${{ matrix.runtime }} + PLATFORM: ${{ matrix.platform }} integration-test: needs: integration-test-matrix @@ -158,8 +188,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Check integration-test results + env: + RESULT: ${{ needs.integration-test-matrix.result }} + IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} run: | - if [ "${{ needs.integration-test-matrix.result }}" != "success" ]; then + if [ "$IS_FORK" = "true" ]; then + echo "::notice::Integration tests are skipped on fork PRs. A maintainer must run them before merging, by pushing these commits to a branch in this repository and opening a PR from it." + exit 0 + fi + if [ "$RESULT" != "success" ]; then echo "Integration tests failed on one or more OS/arch combinations" exit 1 fi @@ -170,8 +207,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Check smoke-test results + env: + RESULT: ${{ needs.smoke-test-arch.result }} + IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} run: | - if [ "${{ needs.smoke-test-arch.result }}" != "success" ]; then + if [ "$IS_FORK" = "true" ]; then + echo "::notice::Smoke tests are skipped on fork PRs. A maintainer must run them before merging, by pushing these commits to a branch in this repository and opening a PR from it." + exit 0 + fi + if [ "$RESULT" != "success" ]; then echo "Smoke tests failed on one or more architectures" exit 1 fi diff --git a/aws-lambda-java-runtime-interface-client/Makefile b/aws-lambda-java-runtime-interface-client/Makefile index 6d1a7762d..afdcc2c5a 100644 --- a/aws-lambda-java-runtime-interface-client/Makefile +++ b/aws-lambda-java-runtime-interface-client/Makefile @@ -1,9 +1,3 @@ -x86_64_ALIAS := amd64 -aarch64_ALIAS := arm64 -ARCHITECTURE := $(shell arch) -ARCHITECTURE_ALIAS := $($(shell echo "$(ARCHITECTURE)_ALIAS")) -ARCHITECTURE_ALIAS := $(or $(ARCHITECTURE_ALIAS),amd64) # on any other archs defaulting to amd64 - # Java 8 does not support passing some args (such add --add-opens) so we need to clear them ifeq ($(IS_JAVA_8),true) EXTRA_LOAD_ARG := -DargLineForReflectionTestOnly="" @@ -24,39 +18,40 @@ target: test: mvn test $(EXTRA_LOAD_ARG) -.PHONY: setup-codebuild-agent -setup-codebuild-agent: - test/integration/codebuild-local/docker-retry.sh docker build --load -t codebuild-agent \ - --build-arg ARCHITECTURE=$(ARCHITECTURE_ALIAS) \ - -f test/integration/codebuild-local/Dockerfile.agent \ - test/integration/codebuild-local +# OS integration tests. Each run builds the RIC, then builds and invokes a +# function image for one OS / distro version / runtime / platform (see +# test/integration/codebuild/scripts/run_os_test.sh). They need docker, maven +# and a JDK 8. CI runs them on CodeBuild-hosted runners. +RUN_OS_TEST := test/integration/codebuild/scripts/run_os_test.sh # Smoke tests are split per-architecture so CI can run each set on a native -# runner. Running the linux/arm64/v8 combos under QEMU on an x86_64 host makes -# `mvn install` recompile curl for aarch64 emulated, which takes ~30 minutes. +# runner. amazoncorretto 11 is left out of the integration matrix +# (test/integration/os-test-matrix.json) because smoke already covers it. +# Changing it here changes integration coverage too. .PHONY: test-smoke test-smoke: test-smoke-x86_64 test-smoke-aarch64 -# amazoncorretto 11 is left out of the CI integration matrix -# (buildspec.os.amazoncorretto.yml) because smoke already covers it. Changing it -# here changes integration coverage too. .PHONY: test-smoke-x86_64 -test-smoke-x86_64: setup-codebuild-agent - CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 corretto11 linux/amd64 - CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11 linux/amd64 +test-smoke-x86_64: + OS_DISTRIBUTION=alpine DISTRO_VERSION=3.15 RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 $(RUN_OS_TEST) + OS_DISTRIBUTION=amazoncorretto DISTRO_VERSION=amazoncorretto RUNTIME_VERSION=11 PLATFORM=linux/amd64 $(RUN_OS_TEST) .PHONY: test-smoke-aarch64 -test-smoke-aarch64: setup-codebuild-agent - CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 corretto11 linux/arm64/v8 - CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11 linux/arm64/v8 - -# BUILDSPEC can point to the buildspec directory (default, runs every OS) or to a -# single buildspec file, which is how CI parallelizes the run across OSes. -BUILDSPEC ?= test/integration/codebuild - +test-smoke-aarch64: + OS_DISTRIBUTION=alpine DISTRO_VERSION=3.15 RUNTIME_VERSION=corretto11 PLATFORM=linux/arm64/v8 $(RUN_OS_TEST) + OS_DISTRIBUTION=amazoncorretto DISTRO_VERSION=amazoncorretto RUNTIME_VERSION=11 PLATFORM=linux/arm64/v8 $(RUN_OS_TEST) + +# Without arguments, runs every combination in test/integration/os-test-matrix.json +# (the CI matrix) for the host's platform; PLATFORMS=all runs every platform. +# With arguments, runs one combination, e.g. +# make test-integ OS_DISTRIBUTION=debian DISTRO_VERSION=bookworm RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 .PHONY: test-integ -test-integ: setup-codebuild-agent - CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_all.sh $(BUILDSPEC) +test-integ: +ifeq ($(OS_DISTRIBUTION),) + test/integration/codebuild/scripts/run_all_os_tests.sh +else + OS_DISTRIBUTION=$(OS_DISTRIBUTION) DISTRO_VERSION=$(DISTRO_VERSION) RUNTIME_VERSION=$(RUNTIME_VERSION) PLATFORM=$(PLATFORM) $(RUN_OS_TEST) +endif # Command to run everytime you make changes to verify everything works .PHONY: dev diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/Dockerfile.agent b/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/Dockerfile.agent deleted file mode 100644 index b077df89d..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/Dockerfile.agent +++ /dev/null @@ -1,31 +0,0 @@ -# syntax=docker/dockerfile:1.4 -FROM public.ecr.aws/amazoncorretto/amazoncorretto:8 - -# Install docker and buildx extension. -# gnupg2 provides gpg/gpgv/gpg-agent so build-jni-lib.sh can GPG-verify the prebuilt assets. -RUN yum install -y --allowerasing docker tar gzip unzip file findutils gnupg2 - -COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx - -# Install maven from apache.org, as version in the yum repository doesn't support latest maven plugins -ENV PATH="$PATH:/apache-maven/bin" -RUN mkdir /apache-maven && \ - curl https://archive.apache.org/dist/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz | \ - tar -xz -C /apache-maven --strip-components 1 - -# Declare JDK 8 in toolchains.xml so maven-toolchains-plugin can resolve it -RUN mkdir -p /root/.m2 && \ - cat > /root/.m2/toolchains.xml < - - - jdk - - 8 - - - ${JAVA_HOME} - - - -EOF diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/codebuild_build.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/codebuild_build.sh deleted file mode 100755 index 2a6ffa972..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/codebuild_build.sh +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/bash -# This file is copied from https://github.com/aws/aws-codebuild-docker-images/blob/282c6634e8c83c2a9841719b09aabfced3461981/local_builds/codebuild_build.sh - -function allOSRealPath() { - if isOSWindows - then - path="" - case $1 in - .* ) path="$PWD/${1#./}" ;; - /* ) path="$1" ;; - * ) path="/$1" ;; - esac - - echo "/$path" | sed -e 's/\\/\//g' -e 's/://' -e 's/./\U&/3' - else - case $1 in - /* ) echo "$1"; exit;; - * ) echo "$PWD/${1#./}"; exit;; - esac - fi -} - -function isOSWindows() { - if [ $OSTYPE == "msys" ] - then - return 0 - else - return 1 - fi -} - -function usage { - echo "usage: codebuild_build.sh [-i image_name] [-a artifact_output_directory] [options]" - echo "Required:" - echo " -i Used to specify the customer build container image." - echo " -a Used to specify an artifact output directory." - echo "Options:" - echo " -l IMAGE Used to override the default local agent image." - echo " -r Used to specify a report output directory." - echo " -s Used to specify source information. Defaults to the current working directory for primary source." - echo " * First (-s) is for primary source" - echo " * Use additional (-s) in : format for secondary source" - echo " * For sourceIdentifier, use a value that is fewer than 128 characters and contains only alphanumeric characters and underscores" - echo " -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables." - echo " -p Used to specify the AWS CLI Profile." - echo " -b FILE Used to specify a buildspec override file. Defaults to buildspec.yml in the source directory." - echo " -m Used to mount the source directory to the customer build container directly." - echo " -d Used to run the build container in docker privileged mode." - echo " -e FILE Used to specify a file containing environment variables." - echo " (-e) File format expectations:" - echo " * Each line is in VAR=VAL format" - echo " * Lines beginning with # are processed as comments and ignored" - echo " * Blank lines are ignored" - echo " * File can be of type .env or .txt" - echo " * There is no special handling of quotation marks, meaning they will be part of the VAL" - exit 1 -} - -image_flag=false -artifact_flag=false -awsconfig_flag=false -mount_src_dir_flag=false -docker_privileged_mode_flag=false - -while getopts "cmdi:a:r:s:b:e:l:p:h" opt; do - case $opt in - i ) image_flag=true; image_name=$OPTARG;; - a ) artifact_flag=true; artifact_dir=$OPTARG;; - r ) report_dir=$OPTARG;; - b ) buildspec=$OPTARG;; - c ) awsconfig_flag=true;; - m ) mount_src_dir_flag=true;; - d ) docker_privileged_mode_flag=true;; - s ) source_dirs+=("$OPTARG");; - e ) environment_variable_file=$OPTARG;; - l ) local_agent_image=$OPTARG;; - p ) aws_profile=$OPTARG;; - h ) usage; exit;; - \? ) echo "Unknown option: -$OPTARG" >&2; exit 1;; - : ) echo "Missing option argument for -$OPTARG" >&2; exit 1;; - * ) echo "Invalid option: -$OPTARG" >&2; exit 1;; - esac -done - -if ! $image_flag -then - echo "The image name flag (-i) must be included for a build to run" >&2 -fi - -if ! $artifact_flag -then - echo "The artifact directory (-a) must be included for a build to run" >&2 -fi - -if ! $image_flag || ! $artifact_flag -then - exit 1 -fi - -docker_command="docker run " -if isOSWindows -then - docker_command+="-v //var/run/docker.sock:/var/run/docker.sock -e " -else - docker_command+="-v /var/run/docker.sock:/var/run/docker.sock -e " -fi - -docker_command+="\"IMAGE_NAME=$image_name\" -e \ - \"ARTIFACTS=$(allOSRealPath "$artifact_dir")\"" - -if [ -n "$report_dir" ] -then - docker_command+=" -e \"REPORTS=$(allOSRealPath "$report_dir")\"" -fi - -if [ -z "$source_dirs" ] -then - docker_command+=" -e \"SOURCE=$(allOSRealPath "$PWD")\"" -else - for index in "${!source_dirs[@]}"; do - if [ $index -eq 0 ] - then - docker_command+=" -e \"SOURCE=$(allOSRealPath "${source_dirs[$index]}")\"" - else - identifier=${source_dirs[$index]%%:*} - src_dir=$(allOSRealPath "${source_dirs[$index]#*:}") - - docker_command+=" -e \"SECONDARY_SOURCE_$index=$identifier:$src_dir\"" - fi - done -fi - -if [ -n "$buildspec" ] -then - docker_command+=" -e \"BUILDSPEC=$(allOSRealPath "$buildspec")\"" -fi - -if [ -n "$environment_variable_file" ] -then - environment_variable_file_path=$(allOSRealPath "$environment_variable_file") - environment_variable_file_dir=$(dirname "$environment_variable_file_path") - environment_variable_file_basename=$(basename "$environment_variable_file") - docker_command+=" -v \"$environment_variable_file_dir:/LocalBuild/envFile/\" -e \"ENV_VAR_FILE=$environment_variable_file_basename\"" -fi - -if [ -n "$local_agent_image" ] -then - docker_command+=" -e \"LOCAL_AGENT_IMAGE_NAME=$local_agent_image\"" -fi - -if $awsconfig_flag -then - if [ -d "$HOME/.aws" ] - then - configuration_file_path=$(allOSRealPath "$HOME/.aws") - docker_command+=" -e \"AWS_CONFIGURATION=$configuration_file_path\"" - else - docker_command+=" -e \"AWS_CONFIGURATION=NONE\"" - fi - - if [ -n "$aws_profile" ] - then - docker_command+=" -e \"AWS_PROFILE=$aws_profile\"" - fi - - docker_command+="$(env | grep ^AWS_ | while read -r line; do echo " -e \"$line\""; done )" -fi - -if $mount_src_dir_flag -then - docker_command+=" -e \"MOUNT_SOURCE_DIRECTORY=TRUE\"" -fi - -if $docker_privileged_mode_flag -then - docker_command+=" -e \"DOCKER_PRIVILEGED_MODE=TRUE\"" -fi - -if isOSWindows -then - docker_command+=" -e \"INITIATOR=$USERNAME\"" -else - docker_command+=" -e \"INITIATOR=$USER\"" -fi - -if [ -n "$local_agent_image" ] -then - docker_command+=" $local_agent_image" -else - docker_command+=" public.ecr.aws/codebuild/local-builds:latest" -fi - -# Note we do not expose the AWS_SECRET_ACCESS_KEY or the AWS_SESSION_TOKEN -exposed_command=$docker_command -secure_variables=( "AWS_SECRET_ACCESS_KEY=" "AWS_SESSION_TOKEN=") -for variable in "${secure_variables[@]}" -do - exposed_command="$(echo $exposed_command | sed "s/\($variable\)[^ ]*/\1********\"/")" -done - -echo "Build Command:" -echo "" -echo $exposed_command -echo "" - -eval $docker_command diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_all.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_all.sh deleted file mode 100755 index cedda98bf..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_all.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -set -euo pipefail - -CODEBUILD_IMAGE_TAG="${CODEBUILD_IMAGE_TAG:-al2/x86_64/standard/3.0}" -DRYRUN="${DRYRUN-0}" -# When set, only the matching platform from each buildspec is run. Used by CI to -# run each architecture on its own native runner instead of emulating via QEMU. -PLATFORM_FILTER="${PLATFORM_FILTER-}" - -function usage { - echo "usage: test_all.sh buildspec_yml_dir_or_file" - echo "Runs all buildspec build-matrix combinations via test_one.sh." - echo "Required:" - echo " buildspec_yml_dir_or_file A directory of buildspec templates (runs every *.yml)," - echo " or a single buildspec .yml file." -} - -do_one_yaml() { - local -r YML="$1" - - OS_DISTRIBUTION=$(grep -oE 'OS_DISTRIBUTION:\s*(\S+)' "$YML" | cut -d' ' -f2) - DISTRO_VERSIONS=$(sed '1,/DISTRO_VERSION/d;/RUNTIME_VERSION/,$d' "$YML" | tr -d '\-" ') - RUNTIME_VERSIONS=$(sed '1,/RUNTIME_VERSION/d;/PLATFORM/,$d' "$YML" | sed '/#.*$/d' | tr -d '\-" ') - PLATFORMS=$(sed '1,/PLATFORM/d;/phases/,$d' "$YML" | tr -d '\-" ') - - if [ -n "$PLATFORM_FILTER" ]; then - PLATFORMS="$PLATFORM_FILTER" - fi - - for DISTRO_VERSION in $DISTRO_VERSIONS; do - for RUNTIME_VERSION in $RUNTIME_VERSIONS; do - for PLATFORM in $PLATFORMS; do - if (( DRYRUN == 1 )); then - echo DRYRUN test_one_combination "$YML" "$OS_DISTRIBUTION" "$DISTRO_VERSION" "$RUNTIME_VERSION" "$PLATFORM" - else - test_one_combination "$YML" "$OS_DISTRIBUTION" "$DISTRO_VERSION" "$RUNTIME_VERSION" "$PLATFORM" - fi - done - done - done -} - -test_one_combination() { - local -r YML="$1" - local -r OS_DISTRIBUTION="$2" - local -r DISTRO_VERSION="$3" - local -r RUNTIME_VERSION="$4" - local -r PLATFORM="$5" - local -r PLATFORM_SANITIZED=$(echo "$PLATFORM" | tr "/" ".") - - echo Testing: - echo " BUILDSPEC" "$YML" - echo " with" "$OS_DISTRIBUTION"-"$DISTRO_VERSION" "$RUNTIME_VERSION" "$PLATFORM" - - "$(dirname "$0")"/test_one.sh "$YML" "$OS_DISTRIBUTION" "$DISTRO_VERSION" "$RUNTIME_VERSION" "$PLATFORM" \ - > >(sed "s/^/$OS_DISTRIBUTION$DISTRO_VERSION-$RUNTIME_VERSION-$PLATFORM_SANITIZED: /") 2> >(sed "s/^/$OS_DISTRIBUTION-$DISTRO_VERSION:$RUNTIME_VERSION:$PLATFORM_SANITIZED: /" >&2) -} - -main() { - if (( $# != 1 && $# != 2)); then - >&2 echo "Invalid number of parameters." - usage - exit 1 - fi - BUILDSPEC_YML_PATH="$1" - - # Allow passing a single buildspec file so CI can parallelize per OS. - if [ -f "$BUILDSPEC_YML_PATH" ]; then - do_one_yaml "$BUILDSPEC_YML_PATH" - return - fi - - HAS_YML=0 - for f in "$BUILDSPEC_YML_PATH"/*.yml ; do - [ -f "$f" ] || continue; - do_one_yaml "$f" - HAS_YML=1 - done - - if (( HAS_YML == 0 )); then - >&2 echo At least one buildspec is required. - exit 2 - fi -} - -main "$@" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_one.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_one.sh deleted file mode 100755 index 172413b0f..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_one.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -set -euo pipefail - -CODEBUILD_IMAGE_TAG="${CODEBUILD_IMAGE_TAG:-al2/x86_64/standard/3.0}" - -function usage { - >&2 echo "usage: test_one.sh buildspec_yml os_distribution distro_version runtime_version [env]" - >&2 echo "Runs one buildspec version combination from a build-matrix buildspec." - >&2 echo "Required:" - >&2 echo " buildspec_yml Used to specify the CodeBuild buildspec template file." - >&2 echo " os_distribution Used to specify the OS distribution to build." - >&2 echo " distro_version Used to specify the distro version of ." - >&2 echo " runtime_version Used to specify the runtime version to test on the selected ." - >&2 echo " platform Used to specify the architecture platform to test on the selected ." - >&2 echo "Optional:" - >&2 echo " env Additional environment variables file." -} - -# codebuild/local-builds images are not multi-architectural -function get_local_agent_image() { - if [[ "$(arch)" == "aarch64" ]]; then - echo "public.ecr.aws/codebuild/local-builds:aarch64" - else - echo "public.ecr.aws/codebuild/local-builds:latest" - fi -} - -main() { - if (( $# != 5 && $# != 6)); then - >&2 echo "Invalid number of parameters." - usage - exit 1 - fi - - BUILDSPEC_YML="$1" - OS_DISTRIBUTION="$2" - DISTRO_VERSION="$3" - RUNTIME_VERSION="$4" - PLATFORM="$5" - PLATFORM_SANITIZED=$(echo "$PLATFORM" | tr "/" ".") - EXTRA_ENV="${6-}" - - CODEBUILD_TEMP_DIR=$(mktemp -d codebuild."$OS_DISTRIBUTION"-"$DISTRO_VERSION"-"$RUNTIME_VERSION"-"$PLATFORM_SANITIZED".XXXXXXXXXX) - trap 'rm -rf $CODEBUILD_TEMP_DIR' EXIT - - # Create an env file for codebuild_build. - ENVFILE="$CODEBUILD_TEMP_DIR/.env" - if [ -f "$EXTRA_ENV" ]; then - cat "$EXTRA_ENV" > "$ENVFILE" - fi - { - echo "" - echo "OS_DISTRIBUTION=$OS_DISTRIBUTION" - echo "DISTRO_VERSION=$DISTRO_VERSION" - echo "RUNTIME_VERSION=$RUNTIME_VERSION" - echo "PLATFORM=$PLATFORM" - } >> "$ENVFILE" - - ARTIFACTS_DIR="$CODEBUILD_TEMP_DIR/artifacts" - mkdir -p "$ARTIFACTS_DIR" - - LOCAL_AGENT_IMAGE="$(get_local_agent_image)" - - if ! docker image inspect "$LOCAL_AGENT_IMAGE" >/dev/null 2>&1; then - "$(dirname "$0")"/docker-retry.sh docker pull "$LOCAL_AGENT_IMAGE" - fi - - # Run CodeBuild local agent. - "$(dirname "$0")"/codebuild_build.sh \ - -i "$CODEBUILD_IMAGE_TAG" \ - -a "$ARTIFACTS_DIR" \ - -e "$ENVFILE" \ - -b "$BUILDSPEC_YML" \ - -s "$(dirname $PWD)" \ - -l "$LOCAL_AGENT_IMAGE" -} - -main "$@" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml index 595de79f3..922590d1d 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml @@ -34,51 +34,6 @@ phases: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - > - if [[ "$PLATFORM" == "linux/amd64" ]]; then - RIE="aws-lambda-rie" - elif [[ "$PLATFORM" == "linux/arm64/v8" ]]; then - RIE="aws-lambda-rie-arm64" - else - echo "Platform $PLATFORM is not currently supported." - exit 1 - fi - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "RUN apk add curl" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --platform="${PLATFORM}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml index efa99cec8..de983c857 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml @@ -35,48 +35,6 @@ phases: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - > - if [[ "$PLATFORM" == "linux/amd64" ]]; then - RIE="aws-lambda-rie" - elif [[ "$PLATFORM" == "linux/arm64/v8" ]]; then - RIE="aws-lambda-rie-arm64" - else - echo "Platform $PLATFORM is not currently supported." - exit 1 - fi - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --platform="${PLATFORM}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml index 0398ca642..72e42f90a 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml @@ -30,39 +30,6 @@ phases: echo "Performing DockerHub login . . ." docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - RIE="aws-lambda-rie" - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml index a229defbc..7ce801930 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml @@ -34,48 +34,6 @@ phases: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - > - if [[ "$PLATFORM" == "linux/amd64" ]]; then - RIE="aws-lambda-rie" - elif [[ "$PLATFORM" == "linux/arm64/v8" ]]; then - RIE="aws-lambda-rie-arm64" - else - echo "Platform $PLATFORM is not currently supported." - exit 1 - fi - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --platform="${PLATFORM}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml index 02f3915c3..01c5ebc12 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml @@ -35,51 +35,6 @@ phases: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - > - if [[ "$PLATFORM" == "linux/amd64" ]]; then - RIE="aws-lambda-rie" - elif [[ "$PLATFORM" == "linux/arm64/v8" ]]; then - RIE="aws-lambda-rie-arm64" - else - echo "Platform $PLATFORM is not currently supported." - exit 1 - fi - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "RUN apt-get update && apt-get install -y curl" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --platform="${PLATFORM}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml index cb63814d0..fbecace8d 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -35,51 +35,6 @@ phases: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD fi - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh - pre_build: - commands: - # Log some environment variables for troubleshooting - - (mvn -v) - # Install events (dependency of serialization) - - (cd aws-lambda-java-events && mvn install) - # Install serialization (dependency of RIC) - - (cd aws-lambda-java-core && mvn install) - - (cd aws-lambda-java-serialization && mvn install) - - (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") - - (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install) - - export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" - - echo "Extracting and including Runtime Interface Emulator" - - SCRATCH_DIR=".scratch" - - mkdir "${SCRATCH_DIR}" - - > - if [[ "$PLATFORM" == "linux/amd64" ]]; then - RIE="aws-lambda-rie" - elif [[ "$PLATFORM" == "linux/arm64/v8" ]]; then - RIE="aws-lambda-rie-arm64" - else - echo "Platform $PLATFORM is not currently supported." - exit 1 - fi - - tar -xvf aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz --directory "${SCRATCH_DIR}" - - > - cp "aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - > - echo "RUN apt-get update && apt-get install -y curl" >> \ - "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" - - echo "Building image ${IMAGE_TAG}" - - > - aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh docker build . \ - -f "${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" \ - -t "${IMAGE_TAG}" \ - --platform="${PLATFORM}" \ - --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ - --build-arg DISTRO_VERSION="${DISTRO_VERSION}" build: commands: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh - finally: - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh - - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh + - aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh index 7e1ed3b1e..9cdfcb338 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh @@ -15,7 +15,7 @@ else fi echo "Installing ${TARGET_EMULATOR} emulator" -"$(dirname "$0")"/../../codebuild-local/docker-retry.sh docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 +"$(dirname "$0")"/docker-retry.sh docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install ${TARGET_EMULATOR} echo "Setting docker build command to default to buildx" echo "Docker buildx version: $(docker buildx version)" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/docker-retry.sh similarity index 100% rename from aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/docker-retry.sh rename to aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/docker-retry.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh new file mode 100755 index 000000000..bdeddc1d9 --- /dev/null +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +# Runs every OS integration test in test/integration/os-test-matrix.json (the +# matrix CI runs) through run_os_test.sh, one after another. Needs jq. +# +# By default only the host's platform runs, since emulated platforms are much +# slower; set PLATFORMS=all for every platform, or e.g. PLATFORMS=linux/amd64. + +set -euo pipefail + +SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)" +MATRIX="${SCRIPTS_DIR}/../../os-test-matrix.json" + +case "$(arch)" in + x86_64) HOST_PLATFORM="linux/amd64" ;; + aarch64 | arm64) HOST_PLATFORM="linux/arm64/v8" ;; + *) HOST_PLATFORM="" ;; +esac +PLATFORMS="${PLATFORMS:-${HOST_PLATFORM}}" + +failed=() +while IFS=$'\t' read -r os distro runtime platform; do + if [[ "${PLATFORMS}" != "all" ]] && [[ "${platform}" != "${PLATFORMS}" ]]; then + continue + fi + echo "=== ${os} ${distro} ${runtime} ${platform}" + if ! OS_DISTRIBUTION="${os}" DISTRO_VERSION="${distro}" RUNTIME_VERSION="${runtime}" PLATFORM="${platform}" \ + "${SCRIPTS_DIR}/run_os_test.sh"; then + failed+=("${os} ${distro} ${runtime} ${platform}") + fi +done < <(jq -r '.[] | .platforms[] as $p | [.os, .distro, .runtime, $p] | @tsv' "${MATRIX}") + +if (( ${#failed[@]} > 0 )); then + printf 'FAILED: %s\n' "${failed[@]}" + exit 1 +fi diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh index f5ebf0687..25869318c 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh @@ -18,8 +18,13 @@ docker run \ sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ${function_jar} ${function_handler}" sleep 2 -# running on arm64 hosts with x86_64 being emulated takes significantly more time than any other combination -if [[ "$(arch)" == "aarch64" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then +# An emulated platform (e.g. arm64 under qemu on an x86_64 host) takes significantly longer +case "$(arch)" in + x86_64) host_platform="linux/amd64" ;; + aarch64) host_platform="linux/arm64/v8" ;; + *) host_platform="" ;; +esac +if [[ "${PLATFORM}" != "${host_platform}" ]]; then declare -i time_out=150 else declare -i time_out=10 @@ -38,6 +43,6 @@ actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)" expected='success' echo "Response: ${actual}" if [[ "${actual}" != "${expected}" ]]; then - echo "fail! runtime: ${RUNTIME} - expected output ${expected} - got ${actual}" + echo "fail! runtime: ${RUNTIME_VERSION} - expected output ${expected} - got ${actual}" exit 1 fi diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh new file mode 100755 index 000000000..33260adaf --- /dev/null +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -0,0 +1,114 @@ +#!/bin/bash +# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +# Runs one OS integration test: builds the RIC and the test handler, builds a +# function image for the given OS, distro version, runtime and platform with the +# Runtime Interface Emulator inside, invokes it and checks the response. +# +# Used by the RIC PR workflow (on CodeBuild-hosted runners), by the per-OS +# buildspecs, and locally (`make test-integ`). Needs docker, maven and a JDK 8 +# as JAVA_HOME, plus a JDK 8 maven toolchain (actions/setup-java writes one). +# +# Required environment: +# OS_DISTRIBUTION alpine | amazoncorretto | amazonlinux | debian | ubuntu +# DISTRO_VERSION e.g. 3.15, 2, bookworm, 24.04 (amazoncorretto for amazoncorretto) +# RUNTIME_VERSION e.g. corretto11, openjdk8, 8, 11 +# PLATFORM linux/amd64 | linux/arm64/v8 +# +# Optional environment: +# BASE_REGISTRY registry the base images come from (default public.ecr.aws). +# CI points it at the ECR pull-through cache; the JNI build +# (src/main/jni/build-jni-lib.sh) reads the same variable. + +set -euo pipefail + +: "${OS_DISTRIBUTION:?}" "${DISTRO_VERSION:?}" "${RUNTIME_VERSION:?}" "${PLATFORM:?}" + +SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "${SCRIPTS_DIR}/../../../../.." && pwd)" +RIC_DIR="aws-lambda-java-runtime-interface-client" +cd "${REPO_ROOT}" +export BASE_REGISTRY="${BASE_REGISTRY:-public.ecr.aws}" + +# Per-OS differences: where the image's JDK lives, and how to add curl (the +# tester container uses it to invoke the function). +case "${OS_DISTRIBUTION}" in + alpine) + DEFAULT_JAVA_BINARY_LOCATION="/usr/bin/java" + CURL_INSTALL="RUN apk add curl" + ;; + debian | ubuntu) + DEFAULT_JAVA_BINARY_LOCATION="/usr/lib/jvm/java-11-amazon-corretto/bin/java" + CURL_INSTALL="RUN apt-get update && apt-get install -y curl" + ;; + amazoncorretto | amazonlinux) + DEFAULT_JAVA_BINARY_LOCATION="/usr/bin/java" + CURL_INSTALL="" + ;; + *) + echo "OS_DISTRIBUTION ${OS_DISTRIBUTION} is not currently supported." + exit 1 + ;; +esac +export JAVA_BINARY_LOCATION="${JAVA_BINARY_LOCATION:-${DEFAULT_JAVA_BINARY_LOCATION}}" + +case "${PLATFORM}" in + linux/amd64) + RIE="aws-lambda-rie" + QEMU_TARGET="x86_64" + EMULATOR="amd64" + ;; + linux/arm64/v8) + RIE="aws-lambda-rie-arm64" + QEMU_TARGET="aarch64" + EMULATOR="arm64" + ;; + *) + echo "Platform ${PLATFORM} is not currently supported." + exit 1 + ;; +esac +export RIE + +# A platform other than the host's (e.g. arm64 locally on an x86_64 machine) +# needs a qemu emulator registered with binfmt_misc. CI runs every platform on +# a native host and skips this. +if [[ "$(arch)" != "${QEMU_TARGET}" ]] && [[ ! -e "/proc/sys/fs/binfmt_misc/qemu-${QEMU_TARGET}" ]]; then + echo "Installing ${EMULATOR} emulator" + "${SCRIPTS_DIR}/docker-retry.sh" docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 + docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install "${EMULATOR}" +fi + +mvn -v +# events is a dependency of serialization +(cd aws-lambda-java-events && mvn install) +(cd aws-lambda-java-core && mvn install) +(cd aws-lambda-java-serialization && mvn install) +(cd "${RIC_DIR}" && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") +(cd "${RIC_DIR}/test/integration/test-handler" && mvn install) + +export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" +echo "Extracting and including Runtime Interface Emulator" +SCRATCH_DIR=".scratch" +rm -rf "${SCRATCH_DIR}" +mkdir "${SCRATCH_DIR}" +tar -xvf "${RIC_DIR}/test/integration/resources/${RIE}.tar.gz" --directory "${SCRATCH_DIR}" + +DOCKERFILE="${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" +cp "${RIC_DIR}/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" "${DOCKERFILE}" +echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> "${DOCKERFILE}" +if [[ -n "${CURL_INSTALL}" ]]; then + echo "${CURL_INSTALL}" >> "${DOCKERFILE}" +fi + +echo "Building image ${IMAGE_TAG}" +"${SCRIPTS_DIR}/docker-retry.sh" docker build . \ + -f "${DOCKERFILE}" \ + -t "${IMAGE_TAG}" \ + --platform="${PLATFORM}" \ + --build-arg BASE_REGISTRY="${BASE_REGISTRY}" \ + --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ + --build-arg DISTRO_VERSION="${DISTRO_VERSION}" + +trap '"${SCRIPTS_DIR}/fetch_test_container_logs.sh"; "${SCRIPTS_DIR}/clean_up.sh"' EXIT +"${SCRIPTS_DIR}/run_invocation_test.sh" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine index bfd288901..e2c557bdc 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine @@ -1,6 +1,7 @@ +ARG BASE_REGISTRY=public.ecr.aws ARG DISTRO_VERSION -FROM public.ecr.aws/docker/library/alpine:${DISTRO_VERSION} +FROM ${BASE_REGISTRY}/docker/library/alpine:${DISTRO_VERSION} RUN apk update && \ apk add openjdk8 diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto index a6958cb05..a54bd133e 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto @@ -1,6 +1,7 @@ +ARG BASE_REGISTRY=public.ecr.aws ARG RUNTIME_VERSION -FROM public.ecr.aws/amazoncorretto/amazoncorretto:${RUNTIME_VERSION} +FROM ${BASE_REGISTRY}/amazoncorretto/amazoncorretto:${RUNTIME_VERSION} ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux index b3d152fc1..dd7ca18ad 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux @@ -1,6 +1,7 @@ +ARG BASE_REGISTRY=public.ecr.aws ARG DISTRO_VERSION -FROM public.ecr.aws/amazonlinux/amazonlinux:${DISTRO_VERSION} +FROM ${BASE_REGISTRY}/amazonlinux/amazonlinux:${DISTRO_VERSION} RUN yum install -y java-1.8.0-openjdk diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian index 019b46a62..f713e5949 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian @@ -1,6 +1,7 @@ +ARG BASE_REGISTRY=public.ecr.aws ARG DISTRO_VERSION -FROM public.ecr.aws/debian/debian:${DISTRO_VERSION} as build-image +FROM ${BASE_REGISTRY}/debian/debian:${DISTRO_VERSION} as build-image RUN apt-get update && \ apt-get install -y wget gnupg ca-certificates && \ @@ -9,7 +10,7 @@ RUN apt-get update && \ apt-get update && \ apt-get install -y java-11-amazon-corretto-jdk -FROM public.ecr.aws/debian/debian:${DISTRO_VERSION} +FROM ${BASE_REGISTRY}/debian/debian:${DISTRO_VERSION} COPY --from=build-image /usr/lib/jvm /usr/lib/jvm diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu index 09107c469..8b0cc59b8 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu @@ -1,6 +1,7 @@ +ARG BASE_REGISTRY=public.ecr.aws ARG DISTRO_VERSION -FROM public.ecr.aws/ubuntu/ubuntu:${DISTRO_VERSION} as build-image +FROM ${BASE_REGISTRY}/ubuntu/ubuntu:${DISTRO_VERSION} as build-image RUN apt-get update && \ apt-get install -y apt-transport-https ca-certificates && \ @@ -10,7 +11,7 @@ RUN apt-get update && \ apt-get update && \ apt-get install -y java-11-amazon-corretto-jdk -FROM public.ecr.aws/ubuntu/ubuntu:${DISTRO_VERSION} +FROM ${BASE_REGISTRY}/ubuntu/ubuntu:${DISTRO_VERSION} COPY --from=build-image /usr/lib/jvm /usr/lib/jvm diff --git a/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json b/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json new file mode 100644 index 000000000..8872cdac3 --- /dev/null +++ b/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json @@ -0,0 +1,10 @@ +[ + { "os": "alpine", "distro": "3.15", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "amazoncorretto", "distro": "amazoncorretto", "runtime": "8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "amazonlinux", "distro": "1", "runtime": "openjdk8", "platforms": ["linux/amd64"] }, + { "os": "amazonlinux", "distro": "2", "runtime": "openjdk8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "debian", "distro": "bookworm", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "debian", "distro": "trixie", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "ubuntu", "distro": "22.04", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "ubuntu", "distro": "24.04", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] } +] From b7ed3e4d1fe55dd85fc2dda85aab665e05b508d7 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 20 Oct 2026 18:16:24 +0000 Subject: [PATCH 02/13] ci(ric): run smoke and OS integration tests on CodeBuild runners The RIC smoke and OS integration tests ran their buildspecs through CodeBuild local on GitHub-hosted runners. Every shard pulled the 1.3 GB codebuild/local-builds image plus all base images anonymously from public.ecr.aws, and GitHub runner IPs are shared with other tenants, so the checks kept failing on its anonymous data limit. - Replace CodeBuild local with run_os_test.sh, one script that runs one OS / distro version / runtime / platform test directly on the host. The per-OS buildspecs, the Makefile targets and CI all call it, so the same tests run locally again (`make test-integ`, `make test-smoke-`). - Move the CI matrix to test/integration/os-test-matrix.json, shared by the workflow and `make test-integ` (run_all_os_tests.sh). - Run the smoke and integration jobs on CodeBuild-hosted runners and pull base images (function images and the JNI build) through an ECR pull-through cache via BASE_REGISTRY. - Skip these jobs on fork PRs, since the runners run in our AWS account; their checks pass with a notice and a maintainer runs the tests from a branch in this repository before merging. - Install a qemu emulator only when a platform differs from the host, and use the long invocation timeout for any emulated platform. - Fix run_invocation_test.sh referencing the unset RUNTIME variable. --- .github/workflows/runtime-interface-client_pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index ba4c0edf6..9039152b4 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -17,9 +17,10 @@ jobs: # Smoke and integration tests build and run containers, so they run on # CodeBuild-hosted runners (projects aws-lambda-java-libs-pr-integ-, - # defined in LambdaRuntimeApiClientsCdk). Image pulls from GitHub-hosted - # runners share IPs with other tenants and hit the public.ecr.aws anonymous - # data limit; pulls from CodeBuild are not capped. + # managed by the maintainers' AWS infrastructure). Image pulls from + # GitHub-hosted runners share IPs with other tenants and hit the + # public.ecr.aws anonymous data limit; these pull through an ECR + # pull-through cache instead. # # They are skipped on fork PRs: those runners run in our AWS account. On a # fork PR the smoke-test and integration-test checks pass with a notice, and From ea9cbaca80d99a91e60fedb1baa1f17ac02eef5c Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Tue, 20 Oct 2026 23:17:09 +0000 Subject: [PATCH 03/13] ci(ric): use the release runners, image JDK and CodeArtifact in PR tests Run the smoke and integration jobs on the existing release CodeBuild runners (aws-lambda-java-libs-test-trigger-) instead of dedicated ones. Those runners are egress-locked, so do what the release jobs do: use the image's preinstalled Corretto 8 (new use-runner-corretto8 action) instead of actions/setup-java, and resolve Maven through the CodeArtifact proxy (configure-maven-mirror). Only the distro package mirrors the test images install from still need egress. --- .../actions/use-runner-corretto8/action.yml | 27 +++++++++ .../workflows/runtime-interface-client_pr.yml | 58 ++++++++++++------- 2 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 .github/actions/use-runner-corretto8/action.yml diff --git a/.github/actions/use-runner-corretto8/action.yml b/.github/actions/use-runner-corretto8/action.yml new file mode 100644 index 000000000..ec0d1b39b --- /dev/null +++ b/.github/actions/use-runner-corretto8/action.yml @@ -0,0 +1,27 @@ +name: Use the runner image's preinstalled Corretto 8 +description: > + Point JAVA_HOME at the CodeBuild image's Corretto 8 and declare it as the JDK 8 + maven toolchain. For CodeBuild-hosted runners in the egress-locked network, + where actions/setup-java cannot download a JDK. + +runs: + using: composite + steps: + # The image ships Corretto 8 at $JAVA_8_HOME (per arch) but defaults + # JAVA_HOME to a newer JDK. + - shell: bash + run: | + echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV" + echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH" + "$JAVA_8_HOME/bin/java" -version + mkdir -p "$HOME/.m2" + cat > "$HOME/.m2/toolchains.xml" < + + + jdk + 8 + $JAVA_8_HOME + + + TOOLCHAINS diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 9039152b4..9603e6453 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -15,12 +15,12 @@ permissions: jobs: - # Smoke and integration tests build and run containers, so they run on - # CodeBuild-hosted runners (projects aws-lambda-java-libs-pr-integ-, - # managed by the maintainers' AWS infrastructure). Image pulls from - # GitHub-hosted runners share IPs with other tenants and hit the - # public.ecr.aws anonymous data limit; these pull through an ECR - # pull-through cache instead. + # Smoke and integration tests build and run containers, so they run on the + # same CodeBuild-hosted runners as the release workflows + # (aws-lambda-java-libs-test-trigger-), in an egress-locked network. + # Image pulls from GitHub-hosted runners share IPs with other tenants and + # hit the public.ecr.aws anonymous data limit; these pull through an ECR + # pull-through cache instead, and Maven resolves through CodeArtifact. # # They are skipped on fork PRs: those runners run in our AWS account. On a # fork PR the smoke-test and integration-test checks pass with a notice, and @@ -35,10 +35,10 @@ jobs: matrix: arch: - name: x86_64 - runner: x86_64 + runner: x86 - name: aarch64 runner: arm64 - runs-on: codebuild-aws-lambda-java-libs-pr-integ-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} + runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} name: "smoke-test (${{ matrix.arch.name }})" # ECR pull-through cache for the base images, as in the release workflow. # ECR_REGISTRY is the login target; BASE_REGISTRY (with the /ecr-public @@ -50,12 +50,21 @@ jobs: steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - name: Set up JDK 1.8 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + - name: Cache Maven repository + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: - java-version: 8 - distribution: corretto - cache: maven + path: ~/.m2/repository + key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-maven- + + # The runners' egress lock blocks the JDK download in actions/setup-java + # and Maven Central, so use the image's JDK and the CodeArtifact proxy. + - name: Use the runner image's preinstalled Corretto 8 + uses: ./.github/actions/use-runner-corretto8 + + - name: Configure Maven CodeArtifact mirror + uses: ./.github/actions/configure-maven-mirror # Uses the runner role's ambient credentials. - name: Log in to Amazon ECR (pull-through cache) @@ -136,7 +145,7 @@ jobs: id: load run: | MATRIX=$(jq -c '{include: [.[] | .platforms[] as $p | {os, distro, runtime, platform: $p, - runner: (if $p == "linux/amd64" then "x86_64" else "arm64" end), + runner: (if $p == "linux/amd64" then "x86" else "arm64" end), label: (if $p == "linux/amd64" then "x64" else "arm64" end)}]}' \ aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json) echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" @@ -144,7 +153,7 @@ jobs: integration-test-matrix: needs: load-integration-test-matrix if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - runs-on: codebuild-aws-lambda-java-libs-pr-integ-${{ matrix.runner }}-${{ github.run_id }}-${{ github.run_attempt }} + runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.runner }}-${{ github.run_id }}-${{ github.run_attempt }} strategy: # Run every OS/arch combination to completion so one failure doesn't mask the others. fail-fast: false @@ -162,12 +171,21 @@ jobs: steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - name: Set up JDK 1.8 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + - name: Cache Maven repository + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: - java-version: 8 - distribution: corretto - cache: maven + path: ~/.m2/repository + key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-maven- + + # The runners' egress lock blocks the JDK download in actions/setup-java + # and Maven Central, so use the image's JDK and the CodeArtifact proxy. + - name: Use the runner image's preinstalled Corretto 8 + uses: ./.github/actions/use-runner-corretto8 + + - name: Configure Maven CodeArtifact mirror + uses: ./.github/actions/configure-maven-mirror # Uses the runner role's ambient credentials. - name: Log in to Amazon ECR (pull-through cache) From 676e827db205dd55e5da53d4f1e284ff47911969 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 00:31:06 +0000 Subject: [PATCH 04/13] ci(ric): shorten workflow and test script comments Keep comments to current behaviour; the rationale is in the PR description. --- .../workflows/runtime-interface-client_pr.yml | 36 ++++++------------- .../Makefile | 5 +-- .../codebuild/scripts/run_all_os_tests.sh | 8 ++--- .../codebuild/scripts/run_os_test.sh | 20 ++++------- 4 files changed, 21 insertions(+), 48 deletions(-) diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 9603e6453..74356d80a 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -15,19 +15,10 @@ permissions: jobs: - # Smoke and integration tests build and run containers, so they run on the - # same CodeBuild-hosted runners as the release workflows - # (aws-lambda-java-libs-test-trigger-), in an egress-locked network. - # Image pulls from GitHub-hosted runners share IPs with other tenants and - # hit the public.ecr.aws anonymous data limit; these pull through an ECR - # pull-through cache instead, and Maven resolves through CodeArtifact. - # - # They are skipped on fork PRs: those runners run in our AWS account. On a - # fork PR the smoke-test and integration-test checks pass with a notice, and - # a maintainer must run the tests before merging by pushing the fork's - # commits to a branch here. This `if` only saves a run; the security boundary - # is the repository setting that requires maintainer approval before any fork - # workflow runs. + # Smoke and integration tests run on the release CodeBuild runners, so base + # images come from the ECR pull-through cache instead of rate-limited + # anonymous public.ecr.aws pulls. Skipped on fork PRs: a maintainer runs them + # from a branch in this repository before merging. smoke-test-arch: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository strategy: @@ -40,9 +31,7 @@ jobs: runner: arm64 runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} name: "smoke-test (${{ matrix.arch.name }})" - # ECR pull-through cache for the base images, as in the release workflow. - # ECR_REGISTRY is the login target; BASE_REGISTRY (with the /ecr-public - # prefix) is read by the JNI build and by run_os_test.sh. + # BASE_REGISTRY is read by the JNI build and run_os_test.sh. env: AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com @@ -58,8 +47,7 @@ jobs: restore-keys: | ${{ runner.os }}-${{ runner.arch }}-maven- - # The runners' egress lock blocks the JDK download in actions/setup-java - # and Maven Central, so use the image's JDK and the CodeArtifact proxy. + # The runners can't reach Maven Central or the setup-java JDK downloads. - name: Use the runner image's preinstalled Corretto 8 uses: ./.github/actions/use-runner-corretto8 @@ -132,8 +120,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # The OS matrix lives in test/integration/os-test-matrix.json so that - # `make test-integ` runs the same combinations locally. + # Shared with `make test-integ`. load-integration-test-matrix: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest @@ -157,13 +144,11 @@ jobs: strategy: # Run every OS/arch combination to completion so one failure doesn't mask the others. fail-fast: false - # Stay well inside the account's concurrent CodeBuild build quota. + # Stays within the account's concurrent CodeBuild build quota. max-parallel: 8 matrix: ${{ fromJson(needs.load-integration-test-matrix.outputs.matrix) }} name: "integration-test (${{ matrix.os }} ${{ matrix.distro }} / ${{ matrix.label }})" - # ECR pull-through cache for the base images, as in the release workflow. - # ECR_REGISTRY is the login target; BASE_REGISTRY (with the /ecr-public - # prefix) is read by the JNI build and by run_os_test.sh. + # BASE_REGISTRY is read by the JNI build and run_os_test.sh. env: AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com @@ -179,8 +164,7 @@ jobs: restore-keys: | ${{ runner.os }}-${{ runner.arch }}-maven- - # The runners' egress lock blocks the JDK download in actions/setup-java - # and Maven Central, so use the image's JDK and the CodeArtifact proxy. + # The runners can't reach Maven Central or the setup-java JDK downloads. - name: Use the runner image's preinstalled Corretto 8 uses: ./.github/actions/use-runner-corretto8 diff --git a/aws-lambda-java-runtime-interface-client/Makefile b/aws-lambda-java-runtime-interface-client/Makefile index afdcc2c5a..f2218c977 100644 --- a/aws-lambda-java-runtime-interface-client/Makefile +++ b/aws-lambda-java-runtime-interface-client/Makefile @@ -18,10 +18,7 @@ target: test: mvn test $(EXTRA_LOAD_ARG) -# OS integration tests. Each run builds the RIC, then builds and invokes a -# function image for one OS / distro version / runtime / platform (see -# test/integration/codebuild/scripts/run_os_test.sh). They need docker, maven -# and a JDK 8. CI runs them on CodeBuild-hosted runners. +# OS integration tests (see test/integration/codebuild/scripts/run_os_test.sh). RUN_OS_TEST := test/integration/codebuild/scripts/run_os_test.sh # Smoke tests are split per-architecture so CI can run each set on a native diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh index bdeddc1d9..366d1f11b 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh @@ -1,11 +1,9 @@ #!/bin/bash # Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# Runs every OS integration test in test/integration/os-test-matrix.json (the -# matrix CI runs) through run_os_test.sh, one after another. Needs jq. -# -# By default only the host's platform runs, since emulated platforms are much -# slower; set PLATFORMS=all for every platform, or e.g. PLATFORMS=linux/amd64. +# Runs every combination in test/integration/os-test-matrix.json through +# run_os_test.sh. Only the host's platform by default (emulation is slow); +# PLATFORMS=all or e.g. PLATFORMS=linux/amd64 to choose. Needs jq. set -euo pipefail diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh index 33260adaf..dbfe33948 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -1,13 +1,10 @@ #!/bin/bash # Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# Runs one OS integration test: builds the RIC and the test handler, builds a -# function image for the given OS, distro version, runtime and platform with the -# Runtime Interface Emulator inside, invokes it and checks the response. -# -# Used by the RIC PR workflow (on CodeBuild-hosted runners), by the per-OS -# buildspecs, and locally (`make test-integ`). Needs docker, maven and a JDK 8 -# as JAVA_HOME, plus a JDK 8 maven toolchain (actions/setup-java writes one). +# Runs one OS integration test: builds the RIC, builds a function image with the +# Runtime Interface Emulator for one OS / version / runtime / platform, invokes +# it and checks the response. Needs docker, maven, and JDK 8 as JAVA_HOME and +# as a maven toolchain. # # Required environment: # OS_DISTRIBUTION alpine | amazoncorretto | amazonlinux | debian | ubuntu @@ -16,9 +13,8 @@ # PLATFORM linux/amd64 | linux/arm64/v8 # # Optional environment: -# BASE_REGISTRY registry the base images come from (default public.ecr.aws). -# CI points it at the ECR pull-through cache; the JNI build -# (src/main/jni/build-jni-lib.sh) reads the same variable. +# BASE_REGISTRY registry for base images (default public.ecr.aws); also read +# by the JNI build. set -euo pipefail @@ -70,9 +66,7 @@ case "${PLATFORM}" in esac export RIE -# A platform other than the host's (e.g. arm64 locally on an x86_64 machine) -# needs a qemu emulator registered with binfmt_misc. CI runs every platform on -# a native host and skips this. +# A platform other than the host's needs a qemu emulator registered with binfmt_misc. if [[ "$(arch)" != "${QEMU_TARGET}" ]] && [[ ! -e "/proc/sys/fs/binfmt_misc/qemu-${QEMU_TARGET}" ]]; then echo "Installing ${EMULATOR} emulator" "${SCRIPTS_DIR}/docker-retry.sh" docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 From 99f52c215925fdf5fa2c680051269690c0cc60e3 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 00:47:57 +0000 Subject: [PATCH 05/13] ci(ric): simplify the PR integration tests - Fold the smoke tests into the integration matrix: alpine 3.15 was already in it, so only amazoncorretto 11 is added. Removes the smoke-test jobs and the test-smoke / pr- make targets. - Stop skipping fork PRs. Fork workflows already need maintainer approval to run, which is the actual gate. - Run local integration tests for the host's platform only, which removes the qemu setup from run_os_test.sh. --- .../workflows/runtime-interface-client_pr.yml | 83 +------------------ .../Makefile | 40 ++------- .../codebuild/buildspec.os.amazoncorretto.yml | 2 +- .../codebuild/scripts/run_all_os_tests.sh | 24 +++--- .../codebuild/scripts/run_invocation_test.sh | 9 +- .../codebuild/scripts/run_os_test.sh | 19 +---- .../test/integration/os-test-matrix.json | 1 + 7 files changed, 27 insertions(+), 151 deletions(-) diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 74356d80a..2bb343991 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -1,5 +1,5 @@ # This workflow builds and tests the aws-lambda-java-runtime-interface-client package. -# It runs on every pull request (no path filter) so that the smoke-test and +# It runs on every pull request (no path filter) so that the build and # integration-test required status checks always report a result and never get # stuck "pending" on PRs that don't touch the RIC/core/serialization paths. @@ -15,55 +15,6 @@ permissions: jobs: - # Smoke and integration tests run on the release CodeBuild runners, so base - # images come from the ECR pull-through cache instead of rate-limited - # anonymous public.ecr.aws pulls. Skipped on fork PRs: a maintainer runs them - # from a branch in this repository before merging. - smoke-test-arch: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - strategy: - fail-fast: true - matrix: - arch: - - name: x86_64 - runner: x86 - - name: aarch64 - runner: arm64 - runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} - name: "smoke-test (${{ matrix.arch.name }})" - # BASE_REGISTRY is read by the JNI build and run_os_test.sh. - env: - AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} - ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com - BASE_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com/ecr-public - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - - name: Cache Maven repository - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-${{ runner.arch }}-maven- - - # The runners can't reach Maven Central or the setup-java JDK downloads. - - name: Use the runner image's preinstalled Corretto 8 - uses: ./.github/actions/use-runner-corretto8 - - - name: Configure Maven CodeArtifact mirror - uses: ./.github/actions/configure-maven-mirror - - # Uses the runner role's ambient credentials. - - name: Log in to Amazon ECR (pull-through cache) - run: | - aws ecr get-login-password --region "$AWS_REGION" \ - | docker login --username AWS --password-stdin "$ECR_REGISTRY" - - - name: Runtime Interface Client smoke tests - Run 'pr-${{ matrix.arch.name }}' target - working-directory: ./aws-lambda-java-runtime-interface-client - run: make pr-${{ matrix.arch.name }} - build-arch: strategy: fail-fast: true @@ -122,7 +73,6 @@ jobs: # Shared with `make test-integ`. load-integration-test-matrix: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest outputs: matrix: ${{ steps.load.outputs.matrix }} @@ -137,9 +87,10 @@ jobs: aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json) echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" + # Runs on the release CodeBuild runners, so base images come from the ECR + # pull-through cache instead of rate-limited anonymous public.ecr.aws pulls. integration-test-matrix: needs: load-integration-test-matrix - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.runner }}-${{ github.run_id }}-${{ github.run_attempt }} strategy: # Run every OS/arch combination to completion so one failure doesn't mask the others. @@ -191,38 +142,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check integration-test results - env: - RESULT: ${{ needs.integration-test-matrix.result }} - IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} run: | - if [ "$IS_FORK" = "true" ]; then - echo "::notice::Integration tests are skipped on fork PRs. A maintainer must run them before merging, by pushing these commits to a branch in this repository and opening a PR from it." - exit 0 - fi - if [ "$RESULT" != "success" ]; then + if [ "${{ needs.integration-test-matrix.result }}" != "success" ]; then echo "Integration tests failed on one or more OS/arch combinations" exit 1 fi - smoke-test: - needs: smoke-test-arch - if: always() - runs-on: ubuntu-latest - steps: - - name: Check smoke-test results - env: - RESULT: ${{ needs.smoke-test-arch.result }} - IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} - run: | - if [ "$IS_FORK" = "true" ]; then - echo "::notice::Smoke tests are skipped on fork PRs. A maintainer must run them before merging, by pushing these commits to a branch in this repository and opening a PR from it." - exit 0 - fi - if [ "$RESULT" != "success" ]; then - echo "Smoke tests failed on one or more architectures" - exit 1 - fi - build: needs: build-arch if: always() diff --git a/aws-lambda-java-runtime-interface-client/Makefile b/aws-lambda-java-runtime-interface-client/Makefile index f2218c977..173d7beb9 100644 --- a/aws-lambda-java-runtime-interface-client/Makefile +++ b/aws-lambda-java-runtime-interface-client/Makefile @@ -18,36 +18,17 @@ target: test: mvn test $(EXTRA_LOAD_ARG) -# OS integration tests (see test/integration/codebuild/scripts/run_os_test.sh). -RUN_OS_TEST := test/integration/codebuild/scripts/run_os_test.sh - -# Smoke tests are split per-architecture so CI can run each set on a native -# runner. amazoncorretto 11 is left out of the integration matrix -# (test/integration/os-test-matrix.json) because smoke already covers it. -# Changing it here changes integration coverage too. -.PHONY: test-smoke -test-smoke: test-smoke-x86_64 test-smoke-aarch64 - -.PHONY: test-smoke-x86_64 -test-smoke-x86_64: - OS_DISTRIBUTION=alpine DISTRO_VERSION=3.15 RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 $(RUN_OS_TEST) - OS_DISTRIBUTION=amazoncorretto DISTRO_VERSION=amazoncorretto RUNTIME_VERSION=11 PLATFORM=linux/amd64 $(RUN_OS_TEST) - -.PHONY: test-smoke-aarch64 -test-smoke-aarch64: - OS_DISTRIBUTION=alpine DISTRO_VERSION=3.15 RUNTIME_VERSION=corretto11 PLATFORM=linux/arm64/v8 $(RUN_OS_TEST) - OS_DISTRIBUTION=amazoncorretto DISTRO_VERSION=amazoncorretto RUNTIME_VERSION=11 PLATFORM=linux/arm64/v8 $(RUN_OS_TEST) - -# Without arguments, runs every combination in test/integration/os-test-matrix.json -# (the CI matrix) for the host's platform; PLATFORMS=all runs every platform. -# With arguments, runs one combination, e.g. +# OS integration tests for the host's platform (see +# test/integration/codebuild/scripts/run_os_test.sh). Without arguments, runs +# every combination in test/integration/os-test-matrix.json; with arguments, +# one combination, e.g. # make test-integ OS_DISTRIBUTION=debian DISTRO_VERSION=bookworm RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 .PHONY: test-integ test-integ: ifeq ($(OS_DISTRIBUTION),) test/integration/codebuild/scripts/run_all_os_tests.sh else - OS_DISTRIBUTION=$(OS_DISTRIBUTION) DISTRO_VERSION=$(DISTRO_VERSION) RUNTIME_VERSION=$(RUNTIME_VERSION) PLATFORM=$(PLATFORM) $(RUN_OS_TEST) + OS_DISTRIBUTION=$(OS_DISTRIBUTION) DISTRO_VERSION=$(DISTRO_VERSION) RUNTIME_VERSION=$(RUNTIME_VERSION) PLATFORM=$(PLATFORM) test/integration/codebuild/scripts/run_os_test.sh endif # Command to run everytime you make changes to verify everything works @@ -56,16 +37,7 @@ dev: test # Verifications to run before sending a pull request .PHONY: pr -pr: test test-smoke - -# Per-architecture PR checks so CI can run each on a native runner (no QEMU). -# No `test` here: the required `build` check already runs the unit tests -# (build-), so CI would only run them twice. -.PHONY: pr-x86_64 -pr-x86_64: test-smoke-x86_64 - -.PHONY: pr-aarch64 -pr-aarch64: test-smoke-aarch64 +pr: test .PHONY: build build: build-x86_64 build-aarch64 diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml index de983c857..ff4d7145d 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml @@ -18,8 +18,8 @@ batch: DISTRO_VERSION: - "amazoncorretto" RUNTIME_VERSION: - # 11 is covered by the smoke tests (Makefile, test-smoke-). - "8" + - "11" PLATFORM: - "linux/amd64" - "linux/arm64/v8" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh index 366d1f11b..d1156a21a 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh @@ -1,9 +1,8 @@ #!/bin/bash # Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. -# Runs every combination in test/integration/os-test-matrix.json through -# run_os_test.sh. Only the host's platform by default (emulation is slow); -# PLATFORMS=all or e.g. PLATFORMS=linux/amd64 to choose. Needs jq. +# Runs every combination in test/integration/os-test-matrix.json for the host's +# platform through run_os_test.sh. Needs jq. set -euo pipefail @@ -13,21 +12,20 @@ MATRIX="${SCRIPTS_DIR}/../../os-test-matrix.json" case "$(arch)" in x86_64) HOST_PLATFORM="linux/amd64" ;; aarch64 | arm64) HOST_PLATFORM="linux/arm64/v8" ;; - *) HOST_PLATFORM="" ;; + *) + echo "Architecture $(arch) is not currently supported." + exit 1 + ;; esac -PLATFORMS="${PLATFORMS:-${HOST_PLATFORM}}" failed=() -while IFS=$'\t' read -r os distro runtime platform; do - if [[ "${PLATFORMS}" != "all" ]] && [[ "${platform}" != "${PLATFORMS}" ]]; then - continue - fi - echo "=== ${os} ${distro} ${runtime} ${platform}" - if ! OS_DISTRIBUTION="${os}" DISTRO_VERSION="${distro}" RUNTIME_VERSION="${runtime}" PLATFORM="${platform}" \ +while IFS=$'\t' read -r os distro runtime; do + echo "=== ${os} ${distro} ${runtime} ${HOST_PLATFORM}" + if ! OS_DISTRIBUTION="${os}" DISTRO_VERSION="${distro}" RUNTIME_VERSION="${runtime}" PLATFORM="${HOST_PLATFORM}" \ "${SCRIPTS_DIR}/run_os_test.sh"; then - failed+=("${os} ${distro} ${runtime} ${platform}") + failed+=("${os} ${distro} ${runtime}") fi -done < <(jq -r '.[] | .platforms[] as $p | [.os, .distro, .runtime, $p] | @tsv' "${MATRIX}") +done < <(jq -r --arg p "${HOST_PLATFORM}" '.[] | select(.platforms | index($p)) | [.os, .distro, .runtime] | @tsv' "${MATRIX}") if (( ${#failed[@]} > 0 )); then printf 'FAILED: %s\n' "${failed[@]}" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh index 25869318c..7910749d1 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh @@ -18,13 +18,8 @@ docker run \ sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ${function_jar} ${function_handler}" sleep 2 -# An emulated platform (e.g. arm64 under qemu on an x86_64 host) takes significantly longer -case "$(arch)" in - x86_64) host_platform="linux/amd64" ;; - aarch64) host_platform="linux/arm64/v8" ;; - *) host_platform="" ;; -esac -if [[ "${PLATFORM}" != "${host_platform}" ]]; then +# running on arm64 hosts with x86_64 being emulated takes significantly more time than any other combination +if [[ "$(arch)" == "aarch64" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then declare -i time_out=150 else declare -i time_out=10 diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh index dbfe33948..1e0b9a6c1 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -49,16 +49,8 @@ esac export JAVA_BINARY_LOCATION="${JAVA_BINARY_LOCATION:-${DEFAULT_JAVA_BINARY_LOCATION}}" case "${PLATFORM}" in - linux/amd64) - RIE="aws-lambda-rie" - QEMU_TARGET="x86_64" - EMULATOR="amd64" - ;; - linux/arm64/v8) - RIE="aws-lambda-rie-arm64" - QEMU_TARGET="aarch64" - EMULATOR="arm64" - ;; + linux/amd64) RIE="aws-lambda-rie" ;; + linux/arm64/v8) RIE="aws-lambda-rie-arm64" ;; *) echo "Platform ${PLATFORM} is not currently supported." exit 1 @@ -66,13 +58,6 @@ case "${PLATFORM}" in esac export RIE -# A platform other than the host's needs a qemu emulator registered with binfmt_misc. -if [[ "$(arch)" != "${QEMU_TARGET}" ]] && [[ ! -e "/proc/sys/fs/binfmt_misc/qemu-${QEMU_TARGET}" ]]; then - echo "Installing ${EMULATOR} emulator" - "${SCRIPTS_DIR}/docker-retry.sh" docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 - docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install "${EMULATOR}" -fi - mvn -v # events is a dependency of serialization (cd aws-lambda-java-events && mvn install) diff --git a/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json b/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json index 8872cdac3..7140a0aff 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json +++ b/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json @@ -1,6 +1,7 @@ [ { "os": "alpine", "distro": "3.15", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, { "os": "amazoncorretto", "distro": "amazoncorretto", "runtime": "8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, + { "os": "amazoncorretto", "distro": "amazoncorretto", "runtime": "11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, { "os": "amazonlinux", "distro": "1", "runtime": "openjdk8", "platforms": ["linux/amd64"] }, { "os": "amazonlinux", "distro": "2", "runtime": "openjdk8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, { "os": "debian", "distro": "bookworm", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, From 70c80ffb47d58cb940716cd88cfee38abd3eaea2 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 00:55:14 +0000 Subject: [PATCH 06/13] ci(ric): note that the PR workflow no longer uses the per-OS buildspecs --- .../test/integration/codebuild/buildspec.os.alpine.yml | 1 + .../test/integration/codebuild/buildspec.os.amazoncorretto.yml | 1 + .../test/integration/codebuild/buildspec.os.amazonlinux.1.yml | 1 + .../test/integration/codebuild/buildspec.os.amazonlinux.2.yml | 1 + .../test/integration/codebuild/buildspec.os.debian.yml | 1 + .../test/integration/codebuild/buildspec.os.ubuntu.yml | 1 + 6 files changed, 6 insertions(+) diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml index 922590d1d..9baddfe91 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml index ff4d7145d..4ac033f7c 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml index 72e42f90a..4eb0b3534 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml index 7ce801930..78de973f1 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml index 01c5ebc12..dcc009119 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml index fbecace8d..9caae6a92 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -1,3 +1,4 @@ +# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. version: 0.2 env: From b56ac2b65d44b3c90790d374aaf37291ca432e71 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:04:12 +0000 Subject: [PATCH 07/13] ci(ric): define the integration test matrix in the workflow The JSON matrix only existed so make test-integ could run every combination locally, and local runs are now one combination at a time. Inline the matrix and drop os-test-matrix.json, the load job and run_all_os_tests.sh. --- .../workflows/runtime-interface-client_pr.yml | 48 +++++++++---------- .../Makefile | 12 ++--- .../codebuild/buildspec.os.alpine.yml | 2 +- .../codebuild/buildspec.os.amazoncorretto.yml | 2 +- .../codebuild/buildspec.os.amazonlinux.1.yml | 2 +- .../codebuild/buildspec.os.amazonlinux.2.yml | 2 +- .../codebuild/buildspec.os.debian.yml | 2 +- .../codebuild/buildspec.os.ubuntu.yml | 2 +- .../codebuild/scripts/run_all_os_tests.sh | 33 ------------- .../test/integration/os-test-matrix.json | 11 ----- 10 files changed, 34 insertions(+), 82 deletions(-) delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh delete mode 100644 aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 2bb343991..1f96b4ad2 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -71,34 +71,34 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # Shared with `make test-integ`. - load-integration-test-matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.load.outputs.matrix }} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - name: Load OS test matrix - id: load - run: | - MATRIX=$(jq -c '{include: [.[] | .platforms[] as $p | {os, distro, runtime, platform: $p, - runner: (if $p == "linux/amd64" then "x86" else "arm64" end), - label: (if $p == "linux/amd64" then "x64" else "arm64" end)}]}' \ - aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json) - echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" - # Runs on the release CodeBuild runners, so base images come from the ECR # pull-through cache instead of rate-limited anonymous public.ecr.aws pulls. integration-test-matrix: - needs: load-integration-test-matrix - runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.runner }}-${{ github.run_id }}-${{ github.run_attempt }} + runs-on: codebuild-aws-lambda-java-libs-test-trigger-${{ matrix.arch.runner }}-${{ github.run_id }}-${{ github.run_attempt }} strategy: # Run every OS/arch combination to completion so one failure doesn't mask the others. fail-fast: false # Stays within the account's concurrent CodeBuild build quota. max-parallel: 8 - matrix: ${{ fromJson(needs.load-integration-test-matrix.outputs.matrix) }} - name: "integration-test (${{ matrix.os }} ${{ matrix.distro }} / ${{ matrix.label }})" + matrix: + target: + - { os: alpine, distro: "3.15", runtime: corretto11 } + - { os: amazoncorretto, distro: amazoncorretto, runtime: "8" } + - { os: amazoncorretto, distro: amazoncorretto, runtime: "11" } + - { os: amazonlinux, distro: "1", runtime: openjdk8 } + - { os: amazonlinux, distro: "2", runtime: openjdk8 } + - { os: debian, distro: bookworm, runtime: corretto11 } + - { os: debian, distro: trixie, runtime: corretto11 } + - { os: ubuntu, distro: "22.04", runtime: corretto11 } + - { os: ubuntu, distro: "24.04", runtime: corretto11 } + arch: + - { label: x64, runner: x86, platform: linux/amd64 } + - { label: arm64, runner: arm64, platform: linux/arm64/v8 } + exclude: + # Amazon Linux 1 has no arm64 image. + - target: { os: amazonlinux, distro: "1", runtime: openjdk8 } + arch: { label: arm64, runner: arm64, platform: linux/arm64/v8 } + name: "integration-test (${{ matrix.target.os }} ${{ matrix.target.distro }} ${{ matrix.target.runtime }} / ${{ matrix.arch.label }})" # BASE_REGISTRY is read by the JNI build and run_os_test.sh. env: AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} @@ -131,10 +131,10 @@ jobs: - name: Run OS integration test run: aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh env: - OS_DISTRIBUTION: ${{ matrix.os }} - DISTRO_VERSION: ${{ matrix.distro }} - RUNTIME_VERSION: ${{ matrix.runtime }} - PLATFORM: ${{ matrix.platform }} + OS_DISTRIBUTION: ${{ matrix.target.os }} + DISTRO_VERSION: ${{ matrix.target.distro }} + RUNTIME_VERSION: ${{ matrix.target.runtime }} + PLATFORM: ${{ matrix.arch.platform }} integration-test: needs: integration-test-matrix diff --git a/aws-lambda-java-runtime-interface-client/Makefile b/aws-lambda-java-runtime-interface-client/Makefile index 173d7beb9..8c58c61c0 100644 --- a/aws-lambda-java-runtime-interface-client/Makefile +++ b/aws-lambda-java-runtime-interface-client/Makefile @@ -18,18 +18,14 @@ target: test: mvn test $(EXTRA_LOAD_ARG) -# OS integration tests for the host's platform (see -# test/integration/codebuild/scripts/run_os_test.sh). Without arguments, runs -# every combination in test/integration/os-test-matrix.json; with arguments, -# one combination, e.g. +# One OS integration test (see test/integration/codebuild/scripts/run_os_test.sh; +# the combinations CI runs are in .github/workflows/runtime-interface-client_pr.yml), e.g. # make test-integ OS_DISTRIBUTION=debian DISTRO_VERSION=bookworm RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 +# A PLATFORM other than the host's needs emulation: built into Docker Desktop; on +# Linux, run once: docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install all .PHONY: test-integ test-integ: -ifeq ($(OS_DISTRIBUTION),) - test/integration/codebuild/scripts/run_all_os_tests.sh -else OS_DISTRIBUTION=$(OS_DISTRIBUTION) DISTRO_VERSION=$(DISTRO_VERSION) RUNTIME_VERSION=$(RUNTIME_VERSION) PLATFORM=$(PLATFORM) test/integration/codebuild/scripts/run_os_test.sh -endif # Command to run everytime you make changes to verify everything works .PHONY: dev diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml index 9baddfe91..08b00588d 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml index 4ac033f7c..0c877e7f7 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml index 4eb0b3534..39317ea7a 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml index 78de973f1..d8be74b77 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml index dcc009119..1586ef63c 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml index 9caae6a92..e13bd86c3 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -1,4 +1,4 @@ -# Not used by the GitHub PR workflow, which runs test/integration/os-test-matrix.json. +# Not used by the GitHub PR workflow (.github/workflows/runtime-interface-client_pr.yml). version: 0.2 env: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh deleted file mode 100755 index d1156a21a..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_all_os_tests.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -# Runs every combination in test/integration/os-test-matrix.json for the host's -# platform through run_os_test.sh. Needs jq. - -set -euo pipefail - -SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)" -MATRIX="${SCRIPTS_DIR}/../../os-test-matrix.json" - -case "$(arch)" in - x86_64) HOST_PLATFORM="linux/amd64" ;; - aarch64 | arm64) HOST_PLATFORM="linux/arm64/v8" ;; - *) - echo "Architecture $(arch) is not currently supported." - exit 1 - ;; -esac - -failed=() -while IFS=$'\t' read -r os distro runtime; do - echo "=== ${os} ${distro} ${runtime} ${HOST_PLATFORM}" - if ! OS_DISTRIBUTION="${os}" DISTRO_VERSION="${distro}" RUNTIME_VERSION="${runtime}" PLATFORM="${HOST_PLATFORM}" \ - "${SCRIPTS_DIR}/run_os_test.sh"; then - failed+=("${os} ${distro} ${runtime}") - fi -done < <(jq -r --arg p "${HOST_PLATFORM}" '.[] | select(.platforms | index($p)) | [.os, .distro, .runtime] | @tsv' "${MATRIX}") - -if (( ${#failed[@]} > 0 )); then - printf 'FAILED: %s\n' "${failed[@]}" - exit 1 -fi diff --git a/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json b/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json deleted file mode 100644 index 7140a0aff..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/os-test-matrix.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { "os": "alpine", "distro": "3.15", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "amazoncorretto", "distro": "amazoncorretto", "runtime": "8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "amazoncorretto", "distro": "amazoncorretto", "runtime": "11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "amazonlinux", "distro": "1", "runtime": "openjdk8", "platforms": ["linux/amd64"] }, - { "os": "amazonlinux", "distro": "2", "runtime": "openjdk8", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "debian", "distro": "bookworm", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "debian", "distro": "trixie", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "ubuntu", "distro": "22.04", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] }, - { "os": "ubuntu", "distro": "24.04", "runtime": "corretto11", "platforms": ["linux/amd64", "linux/arm64/v8"] } -] From 7bd24bb5f8bd00ed8e778c26751d5b590e75d1cf Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:13:25 +0000 Subject: [PATCH 08/13] ci(ric): document local OS integration tests; fix emulated timeout on macOS run_invocation_test.sh only gave emulated runs the long timeout on aarch64 hosts, so emulated tests on macOS (where arch prints arm64 or i386) or on x86_64 hosts used the 10s timeout. Use it for any platform that isn't the host's. --- .../README.md | 28 +++++++++++++++++++ .../codebuild/scripts/run_invocation_test.sh | 10 +++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/aws-lambda-java-runtime-interface-client/README.md b/aws-lambda-java-runtime-interface-client/README.md index a49bf87b4..ac1d3171a 100644 --- a/aws-lambda-java-runtime-interface-client/README.md +++ b/aws-lambda-java-runtime-interface-client/README.md @@ -161,6 +161,34 @@ This single command will: The test uses a simple EchoHandler that returns the input event, making it easy to verify the runtime interface client is working correctly. +### OS Integration Tests + +CI runs the runtime interface client on a matrix of base images (Alpine, Amazon Corretto, Amazon Linux, Debian, Ubuntu), JDKs and platforms; the combinations are in `.github/workflows/runtime-interface-client_pr.yml`. Each test builds the RIC, builds a function image with RIE for one combination, invokes it and checks the response. + +*Prerequisites:* +- Docker, Maven and a JDK 8 as `JAVA_HOME` +- The same JDK declared as the JDK 8 Maven toolchain in `~/.m2/toolchains.xml`: + +```xml + + + jdk + 8 + /path/to/jdk8 + + +``` + +*To run one combination:* + +```shell script +make test-integ OS_DISTRIBUTION=debian DISTRO_VERSION=bookworm RUNTIME_VERSION=corretto11 PLATFORM=linux/amd64 +``` + +`PLATFORM` is `linux/amd64` or `linux/arm64/v8`. A platform other than your machine's runs under emulation, which is much slower: +- macOS and Windows: Docker Desktop emulates it out of the box. On Windows, run the commands inside WSL2. +- Linux: register the emulator once with `docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install all`. + ## Test Coverage This project uses JaCoCo for code coverage analysis. To exclude classes from JaCoCo coverage, add them to the `jacoco-maven-plugin` configuration: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh index 7910749d1..62f123559 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh @@ -18,8 +18,14 @@ docker run \ sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ${function_jar} ${function_handler}" sleep 2 -# running on arm64 hosts with x86_64 being emulated takes significantly more time than any other combination -if [[ "$(arch)" == "aarch64" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then +# An emulated platform (one that isn't the host's) takes significantly longer. +# `arch` prints aarch64/x86_64 on Linux, arm64/i386 on macOS. +case "$(arch)" in + aarch64 | arm64) host_platform="linux/arm64/v8" ;; + x86_64 | i386) host_platform="linux/amd64" ;; + *) host_platform="" ;; +esac +if [[ "${PLATFORM}" != "${host_platform}" ]]; then declare -i time_out=150 else declare -i time_out=10 From efda9b2aefca284441ab81d84124cd527b2d67aa Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:25:39 +0000 Subject: [PATCH 09/13] ci: cache the JNI build base images in the Actions cache The JNI build pulls amazonlinux:2 and alpine:3 from public.ecr.aws on every Maven build, so the build, coverage and dockerized-test jobs kept failing on the anonymous data limit shared by GitHub runner IPs. Load the images from the Actions cache into the local image store (pulling only on a weekly cache miss) and use the buildx docker driver, which builds from the local store. --- .../actions/cache-jni-base-images/action.yml | 32 +++++++++++++++++++ .github/workflows/dockerized-test.yml | 4 +++ ...runtime-interface-client_merge_to_main.yml | 5 +++ .../workflows/runtime-interface-client_pr.yml | 5 +++ 4 files changed, 46 insertions(+) create mode 100644 .github/actions/cache-jni-base-images/action.yml diff --git a/.github/actions/cache-jni-base-images/action.yml b/.github/actions/cache-jni-base-images/action.yml new file mode 100644 index 000000000..5b010b8ce --- /dev/null +++ b/.github/actions/cache-jni-base-images/action.yml @@ -0,0 +1,32 @@ +name: Cache the JNI build base images +description: > + Load the JNI build base images into the local Docker image store from the + Actions cache, pulling them from public.ecr.aws only on a cache miss. The JNI + build then reuses them, provided buildx uses the docker driver. + +runs: + using: composite + steps: + # Weekly key, so the images are refreshed once a week. + - id: key + shell: bash + run: echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" + + - id: cache + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ${{ runner.temp }}/jni-base-images.tar + key: jni-base-images-${{ runner.os }}-${{ runner.arch }}-${{ steps.key.outputs.week }} + + - if: steps.cache.outputs.cache-hit == 'true' + shell: bash + run: docker load -i "${{ runner.temp }}/jni-base-images.tar" + + - if: steps.cache.outputs.cache-hit != 'true' + shell: bash + run: | + images="public.ecr.aws/amazonlinux/amazonlinux:2 public.ecr.aws/docker/library/alpine:3" + for image in $images; do + aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/docker-retry.sh docker pull "$image" + done + docker save -o "${{ runner.temp }}/jni-base-images.tar" $images diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index d83490589..2f8af9b8f 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -32,6 +32,10 @@ jobs: distribution: corretto cache: maven + # The default buildx driver (docker) uses the local image store. + - name: Load the JNI build base images + uses: ./.github/actions/cache-jni-base-images + - name: Build core, serialization and the RIC under test run: | mvn -B -q install -DskipTests --file aws-lambda-java-core/pom.xml diff --git a/.github/workflows/runtime-interface-client_merge_to_main.yml b/.github/workflows/runtime-interface-client_merge_to_main.yml index 2b9625983..78d81769f 100644 --- a/.github/workflows/runtime-interface-client_merge_to_main.yml +++ b/.github/workflows/runtime-interface-client_merge_to_main.yml @@ -121,6 +121,11 @@ jobs: uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 with: install: true + # Uses the local image store, so the JNI build reuses the cached base images. + driver: docker + + - name: Load the JNI build base images + uses: ./.github/actions/cache-jni-base-images - name: Build and install core dependency locally working-directory: ./aws-lambda-java-core diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 1f96b4ad2..7eda0d6c7 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -40,6 +40,11 @@ jobs: uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 with: install: true + # Uses the local image store, so the JNI build reuses the cached base images. + driver: docker + + - name: Load the JNI build base images + uses: ./.github/actions/cache-jni-base-images - name: Build and install core dependency locally working-directory: ./aws-lambda-java-core From d64c4a89e2488fcd53e711cd85a9c16bcad8a0f9 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:32:32 +0000 Subject: [PATCH 10/13] ci(ric): install curl and RIE in the function Dockerfiles run_os_test.sh copied each Dockerfile.function.* into .scratch and appended the curl install and the RIE COPY. Do both in the Dockerfiles (ADD unpacks the RIE archive, RIE is a build arg), so each Dockerfile is the full image definition and the script builds it directly. --- .../codebuild/scripts/run_os_test.sh | 27 +++---------------- .../docker/Dockerfile.function.alpine | 5 +++- .../docker/Dockerfile.function.amazoncorretto | 3 +++ .../docker/Dockerfile.function.amazonlinux | 3 +++ .../docker/Dockerfile.function.debian | 5 ++++ .../docker/Dockerfile.function.ubuntu | 5 ++++ 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh index 1e0b9a6c1..73a28cda0 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -26,20 +26,13 @@ RIC_DIR="aws-lambda-java-runtime-interface-client" cd "${REPO_ROOT}" export BASE_REGISTRY="${BASE_REGISTRY:-public.ecr.aws}" -# Per-OS differences: where the image's JDK lives, and how to add curl (the -# tester container uses it to invoke the function). +# Where the image's JDK lives. case "${OS_DISTRIBUTION}" in - alpine) + alpine | amazoncorretto | amazonlinux) DEFAULT_JAVA_BINARY_LOCATION="/usr/bin/java" - CURL_INSTALL="RUN apk add curl" ;; debian | ubuntu) DEFAULT_JAVA_BINARY_LOCATION="/usr/lib/jvm/java-11-amazon-corretto/bin/java" - CURL_INSTALL="RUN apt-get update && apt-get install -y curl" - ;; - amazoncorretto | amazonlinux) - DEFAULT_JAVA_BINARY_LOCATION="/usr/bin/java" - CURL_INSTALL="" ;; *) echo "OS_DISTRIBUTION ${OS_DISTRIBUTION} is not currently supported." @@ -67,25 +60,13 @@ mvn -v (cd "${RIC_DIR}/test/integration/test-handler" && mvn install) export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" -echo "Extracting and including Runtime Interface Emulator" -SCRATCH_DIR=".scratch" -rm -rf "${SCRATCH_DIR}" -mkdir "${SCRATCH_DIR}" -tar -xvf "${RIC_DIR}/test/integration/resources/${RIE}.tar.gz" --directory "${SCRATCH_DIR}" - -DOCKERFILE="${SCRATCH_DIR}/Dockerfile.function.${OS_DISTRIBUTION}.tmp" -cp "${RIC_DIR}/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" "${DOCKERFILE}" -echo "COPY ${SCRATCH_DIR}/${RIE} /usr/bin/${RIE}" >> "${DOCKERFILE}" -if [[ -n "${CURL_INSTALL}" ]]; then - echo "${CURL_INSTALL}" >> "${DOCKERFILE}" -fi - echo "Building image ${IMAGE_TAG}" "${SCRIPTS_DIR}/docker-retry.sh" docker build . \ - -f "${DOCKERFILE}" \ + -f "${RIC_DIR}/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ -t "${IMAGE_TAG}" \ --platform="${PLATFORM}" \ --build-arg BASE_REGISTRY="${BASE_REGISTRY}" \ + --build-arg RIE="${RIE}" \ --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ --build-arg DISTRO_VERSION="${DISTRO_VERSION}" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine index e2c557bdc..6b21276c4 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine @@ -4,10 +4,13 @@ ARG DISTRO_VERSION FROM ${BASE_REGISTRY}/docker/library/alpine:${DISTRO_VERSION} RUN apk update && \ - apk add openjdk8 + apk add openjdk8 curl ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . +ARG RIE +ADD aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz /usr/bin/ + ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"] CMD ["helloworld.App"] diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto index a54bd133e..635bb3338 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto @@ -5,6 +5,9 @@ FROM ${BASE_REGISTRY}/amazoncorretto/amazoncorretto:${RUNTIME_VERSION} ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . +ARG RIE +ADD aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz /usr/bin/ + ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"] CMD ["helloworld.App"] diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux index dd7ca18ad..b6ef31cb2 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux @@ -7,6 +7,9 @@ RUN yum install -y java-1.8.0-openjdk ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . +ARG RIE +ADD aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz /usr/bin/ + ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"] CMD ["helloworld.App"] diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian index f713e5949..cc2f0f199 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian @@ -14,10 +14,15 @@ FROM ${BASE_REGISTRY}/debian/debian:${DISTRO_VERSION} COPY --from=build-image /usr/lib/jvm /usr/lib/jvm +RUN apt-get update && apt-get install -y curl + ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . ENV PATH=/usr/lib/jvm/java-11-amazon-corretto/bin/:$PATH +ARG RIE +ADD aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz /usr/bin/ + ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"] CMD ["helloworld.App"] diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu index 8b0cc59b8..d77129255 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu @@ -15,10 +15,15 @@ FROM ${BASE_REGISTRY}/ubuntu/ubuntu:${DISTRO_VERSION} COPY --from=build-image /usr/lib/jvm /usr/lib/jvm +RUN apt-get update && apt-get install -y curl + ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar . ENV PATH=/usr/lib/jvm/java-11-amazon-corretto/bin/:$PATH +ARG RIE +ADD aws-lambda-java-runtime-interface-client/test/integration/resources/${RIE}.tar.gz /usr/bin/ + ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"] CMD ["helloworld.App"] From 684d703e62a4ef936a51a2d3035ad8300f19444b Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:47:32 +0000 Subject: [PATCH 11/13] ci(ric): address review findings on the PR integration tests - Log in to the ECR pull-through cache with the runner's account and region instead of repository secrets, which fork PRs don't get. - Skip unit tests when building in run_os_test.sh; the build job runs them. - Don't retry the function image build; pulls go through the cache, and a broken Dockerfile should fail fast. - Fold run_invocation_test.sh, fetch_test_container_logs.sh and clean_up.sh into run_os_test.sh, with container and network names per OS / version / runtime so local runs don't collide. - Start the function with `java` from the image's PATH, dropping JAVA_BINARY_LOCATION. - cache-jni-base-images: pull when the cached tar can't be loaded. - dockerized-test: also run when cache-jni-base-images changes. --- .../actions/cache-jni-base-images/action.yml | 16 ++-- .github/workflows/dockerized-test.yml | 1 + .../workflows/runtime-interface-client_pr.yml | 16 ++-- .../codebuild/buildspec.os.alpine.yml | 1 - .../codebuild/buildspec.os.amazoncorretto.yml | 1 - .../codebuild/buildspec.os.amazonlinux.1.yml | 1 - .../codebuild/buildspec.os.amazonlinux.2.yml | 1 - .../codebuild/buildspec.os.debian.yml | 1 - .../codebuild/buildspec.os.ubuntu.yml | 1 - .../integration/codebuild/scripts/clean_up.sh | 11 --- .../scripts/fetch_test_container_logs.sh | 15 ---- .../codebuild/scripts/run_invocation_test.sh | 49 ----------- .../codebuild/scripts/run_os_test.sh | 84 +++++++++++++------ 13 files changed, 76 insertions(+), 122 deletions(-) delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh delete mode 100755 aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh diff --git a/.github/actions/cache-jni-base-images/action.yml b/.github/actions/cache-jni-base-images/action.yml index 5b010b8ce..4fa14a324 100644 --- a/.github/actions/cache-jni-base-images/action.yml +++ b/.github/actions/cache-jni-base-images/action.yml @@ -18,15 +18,17 @@ runs: path: ${{ runner.temp }}/jni-base-images.tar key: jni-base-images-${{ runner.os }}-${{ runner.arch }}-${{ steps.key.outputs.week }} - - if: steps.cache.outputs.cache-hit == 'true' - shell: bash - run: docker load -i "${{ runner.temp }}/jni-base-images.tar" - - - if: steps.cache.outputs.cache-hit != 'true' - shell: bash + # Pulls on a cache miss, or when the cached tar can't be loaded. + - shell: bash + env: + CACHE_HIT: ${{ steps.cache.outputs.cache-hit }} + TAR: ${{ runner.temp }}/jni-base-images.tar run: | + if [[ "$CACHE_HIT" == "true" ]] && docker load -i "$TAR"; then + exit 0 + fi images="public.ecr.aws/amazonlinux/amazonlinux:2 public.ecr.aws/docker/library/alpine:3" for image in $images; do aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/docker-retry.sh docker pull "$image" done - docker save -o "${{ runner.temp }}/jni-base-images.tar" $images + docker save -o "$TAR" $images diff --git a/.github/workflows/dockerized-test.yml b/.github/workflows/dockerized-test.yml index 2f8af9b8f..ab9aecb90 100644 --- a/.github/workflows/dockerized-test.yml +++ b/.github/workflows/dockerized-test.yml @@ -13,6 +13,7 @@ on: - 'aws-lambda-java-serialization/**' - 'aws-lambda-java-runtime-interface-client/**' - '.github/workflows/dockerized-test.yml' + - '.github/actions/cache-jni-base-images/**' workflow_dispatch: jobs: diff --git a/.github/workflows/runtime-interface-client_pr.yml b/.github/workflows/runtime-interface-client_pr.yml index 7eda0d6c7..62e9478ad 100644 --- a/.github/workflows/runtime-interface-client_pr.yml +++ b/.github/workflows/runtime-interface-client_pr.yml @@ -104,11 +104,6 @@ jobs: - target: { os: amazonlinux, distro: "1", runtime: openjdk8 } arch: { label: arm64, runner: arm64, platform: linux/arm64/v8 } name: "integration-test (${{ matrix.target.os }} ${{ matrix.target.distro }} ${{ matrix.target.runtime }} / ${{ matrix.arch.label }})" - # BASE_REGISTRY is read by the JNI build and run_os_test.sh. - env: - AWS_REGION: ${{ vars.AWS_REGION_MAVEN_RELEASE }} - ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com - BASE_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION_MAVEN_RELEASE }}.amazonaws.com/ecr-public steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 @@ -127,11 +122,16 @@ jobs: - name: Configure Maven CodeArtifact mirror uses: ./.github/actions/configure-maven-mirror - # Uses the runner role's ambient credentials. + # Uses the runner's ambient credentials and region, not repository secrets, + # which fork PRs don't get. BASE_REGISTRY is read by run_os_test.sh. - name: Log in to Amazon ECR (pull-through cache) run: | - aws ecr get-login-password --region "$AWS_REGION" \ - | docker login --username AWS --password-stdin "$ECR_REGISTRY" + region="${AWS_REGION:-$AWS_DEFAULT_REGION}" + account="$(aws sts get-caller-identity --query Account --output text)" + registry="${account}.dkr.ecr.${region}.amazonaws.com" + aws ecr get-login-password --region "$region" \ + | docker login --username AWS --password-stdin "$registry" + echo "BASE_REGISTRY=${registry}/ecr-public" >> "$GITHUB_ENV" - name: Run OS integration test run: aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml index 08b00588d..53e914174 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: alpine - JAVA_BINARY_LOCATION: "/usr/bin/java" DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_PLUGIN_DIR: "/root/.docker/cli-plugins" batch: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml index 0c877e7f7..9e3b2eff3 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: amazoncorretto - JAVA_BINARY_LOCATION: "/usr/bin/java" DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_PLUGIN_DIR: "/root/.docker/cli-plugins" batch: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml index 39317ea7a..9047bb1e1 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.1.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: amazonlinux - JAVA_BINARY_LOCATION: "/usr/bin/java" batch: build-matrix: static: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml index d8be74b77..87f123585 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazonlinux.2.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: amazonlinux - JAVA_BINARY_LOCATION: "/usr/bin/java" DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_PLUGIN_DIR: "/root/.docker/cli-plugins" batch: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml index 1586ef63c..026b595b6 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.debian.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: debian - JAVA_BINARY_LOCATION: "/usr/lib/jvm/java-11-amazon-corretto/bin/java" DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_PLUGIN_DIR: "/root/.docker/cli-plugins" batch: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml index e13bd86c3..2d1a3f8c2 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -4,7 +4,6 @@ version: 0.2 env: variables: OS_DISTRIBUTION: ubuntu - JAVA_BINARY_LOCATION: "/usr/lib/jvm/java-11-amazon-corretto/bin/java" DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_PLUGIN_DIR: "/root/.docker/cli-plugins" batch: diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh deleted file mode 100755 index 236fa7b26..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -set -euo pipefail - -echo "Cleaning up..." -docker stop "${OS_DISTRIBUTION}-app" || true -docker rm --force "${OS_DISTRIBUTION}-app" || true -docker stop "${OS_DISTRIBUTION}-tester" || true -docker rm --force "${OS_DISTRIBUTION}-tester" || true -docker network rm "${OS_DISTRIBUTION}-network" || true diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh deleted file mode 100755 index 4bc809dc1..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -set -euo pipefail - -echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------" -echo -docker logs "${OS_DISTRIBUTION}-app" || true -echo -echo "---------------------------------------------------" -echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------" -echo -docker logs "${OS_DISTRIBUTION}-tester" || true -echo -echo "---------------------------------------------------" diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh deleted file mode 100755 index 62f123559..000000000 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -set -euxo pipefail - -echo "Running Image ${IMAGE_TAG}" -docker network create "${OS_DISTRIBUTION}-network" - -function_jar="./HelloWorld-1.0.jar" -function_handler="helloworld.App" -docker run \ - --detach \ - --name "${OS_DISTRIBUTION}-app" \ - --network "${OS_DISTRIBUTION}-network" \ - --entrypoint="" \ - --platform="${PLATFORM}" \ - "${IMAGE_TAG}" \ - sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ${function_jar} ${function_handler}" -sleep 2 - -# An emulated platform (one that isn't the host's) takes significantly longer. -# `arch` prints aarch64/x86_64 on Linux, arm64/i386 on macOS. -case "$(arch)" in - aarch64 | arm64) host_platform="linux/arm64/v8" ;; - x86_64 | i386) host_platform="linux/amd64" ;; - *) host_platform="" ;; -esac -if [[ "${PLATFORM}" != "${host_platform}" ]]; then - declare -i time_out=150 -else - declare -i time_out=10 -fi - -docker run \ - --name "${OS_DISTRIBUTION}-tester" \ - --env "TARGET=${OS_DISTRIBUTION}-app" \ - --env "MAX_TIME=${time_out}" \ - --network "${OS_DISTRIBUTION}-network" \ - --entrypoint="" \ - --platform="${PLATFORM}" \ - "${IMAGE_TAG}" \ - sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time ${MAX_TIME}' -actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)" -expected='success' -echo "Response: ${actual}" -if [[ "${actual}" != "${expected}" ]]; then - echo "fail! runtime: ${RUNTIME_VERSION} - expected output ${expected} - got ${actual}" - exit 1 -fi diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh index 73a28cda0..bc31ff992 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -26,21 +26,6 @@ RIC_DIR="aws-lambda-java-runtime-interface-client" cd "${REPO_ROOT}" export BASE_REGISTRY="${BASE_REGISTRY:-public.ecr.aws}" -# Where the image's JDK lives. -case "${OS_DISTRIBUTION}" in - alpine | amazoncorretto | amazonlinux) - DEFAULT_JAVA_BINARY_LOCATION="/usr/bin/java" - ;; - debian | ubuntu) - DEFAULT_JAVA_BINARY_LOCATION="/usr/lib/jvm/java-11-amazon-corretto/bin/java" - ;; - *) - echo "OS_DISTRIBUTION ${OS_DISTRIBUTION} is not currently supported." - exit 1 - ;; -esac -export JAVA_BINARY_LOCATION="${JAVA_BINARY_LOCATION:-${DEFAULT_JAVA_BINARY_LOCATION}}" - case "${PLATFORM}" in linux/amd64) RIE="aws-lambda-rie" ;; linux/arm64/v8) RIE="aws-lambda-rie-arm64" ;; @@ -49,19 +34,21 @@ case "${PLATFORM}" in exit 1 ;; esac -export RIE +# Unit tests run in the build job; only the artifacts are needed here. mvn -v -# events is a dependency of serialization -(cd aws-lambda-java-events && mvn install) -(cd aws-lambda-java-core && mvn install) -(cd aws-lambda-java-serialization && mvn install) -(cd "${RIC_DIR}" && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="") -(cd "${RIC_DIR}/test/integration/test-handler" && mvn install) +(cd aws-lambda-java-events && mvn install -DskipTests) +(cd aws-lambda-java-core && mvn install -DskipTests) +(cd aws-lambda-java-serialization && mvn install -DskipTests) +(cd "${RIC_DIR}" && mvn install -DskipTests -DmultiArch=false) +(cd "${RIC_DIR}/test/integration/test-handler" && mvn install -DskipTests) + +# Unique per combination, so different combinations can run side by side. +NAME="${OS_DISTRIBUTION}-${DISTRO_VERSION//./-}-${RUNTIME_VERSION//./-}" +IMAGE_TAG="java-integ-test:${NAME}" -export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}" echo "Building image ${IMAGE_TAG}" -"${SCRIPTS_DIR}/docker-retry.sh" docker build . \ +docker build . \ -f "${RIC_DIR}/test/integration/docker/Dockerfile.function.${OS_DISTRIBUTION}" \ -t "${IMAGE_TAG}" \ --platform="${PLATFORM}" \ @@ -70,5 +57,50 @@ echo "Building image ${IMAGE_TAG}" --build-arg RUNTIME_VERSION="${RUNTIME_VERSION}" \ --build-arg DISTRO_VERSION="${DISTRO_VERSION}" -trap '"${SCRIPTS_DIR}/fetch_test_container_logs.sh"; "${SCRIPTS_DIR}/clean_up.sh"' EXIT -"${SCRIPTS_DIR}/run_invocation_test.sh" +cleanup() { + for container in "${NAME}-app" "${NAME}-tester"; do + echo "--------- Container logs: ${container} ---------" + docker logs "${container}" || true + docker rm --force "${container}" >/dev/null 2>&1 || true + done + docker network rm "${NAME}-network" >/dev/null 2>&1 || true +} +trap cleanup EXIT + +docker network create "${NAME}-network" +docker run \ + --detach \ + --name "${NAME}-app" \ + --network "${NAME}-network" \ + --entrypoint="" \ + --platform="${PLATFORM}" \ + "${IMAGE_TAG}" \ + sh -c "/usr/bin/${RIE} java -jar ./HelloWorld-1.0.jar helloworld.App" +sleep 2 + +# An emulated platform (one that isn't the host's) takes significantly longer. +# `arch` prints aarch64/x86_64 on Linux, arm64/i386 on macOS. +case "$(arch)" in + aarch64 | arm64) host_platform="linux/arm64/v8" ;; + x86_64 | i386) host_platform="linux/amd64" ;; + *) host_platform="" ;; +esac +if [[ "${PLATFORM}" != "${host_platform}" ]]; then + max_time=150 +else + max_time=10 +fi + +docker run \ + --name "${NAME}-tester" \ + --network "${NAME}-network" \ + --entrypoint="" \ + --platform="${PLATFORM}" \ + "${IMAGE_TAG}" \ + curl -sS -X POST "http://${NAME}-app:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time "${max_time}" +actual="$(docker logs --tail 1 "${NAME}-tester" | xargs)" +echo "Response: ${actual}" +if [[ "${actual}" != "success" ]]; then + echo "fail! ${OS_DISTRIBUTION} ${DISTRO_VERSION} ${RUNTIME_VERSION} ${PLATFORM} - expected output success - got ${actual}" + exit 1 +fi From 0a340b9821440305e2ce62d25713b6cd2ae05ac8 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 01:56:01 +0000 Subject: [PATCH 12/13] ci(ric): pass RIE an absolute java path RIE doesn't look the bootstrap up on PATH, so resolve it in the container's shell. --- .../test/integration/codebuild/scripts/run_os_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh index bc31ff992..fd22115bd 100755 --- a/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh +++ b/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_os_test.sh @@ -75,7 +75,7 @@ docker run \ --entrypoint="" \ --platform="${PLATFORM}" \ "${IMAGE_TAG}" \ - sh -c "/usr/bin/${RIE} java -jar ./HelloWorld-1.0.jar helloworld.App" + sh -c "/usr/bin/${RIE} \$(command -v java) -jar ./HelloWorld-1.0.jar helloworld.App" sleep 2 # An emulated platform (one that isn't the host's) takes significantly longer. From 8eef167d79fc13b57b1c72d50a8675beb3663854 Mon Sep 17 00:00:00 2001 From: Davide Melfi Date: Wed, 21 Oct 2026 02:03:33 +0000 Subject: [PATCH 13/13] ci(ric): default the version build args in the function Dockerfiles Every ARG used in FROM needs a default, otherwise BuildKit warns InvalidDefaultArgInFrom. run_os_test.sh always passes them. --- .../test/integration/docker/Dockerfile.function.alpine | 2 +- .../test/integration/docker/Dockerfile.function.amazoncorretto | 2 +- .../test/integration/docker/Dockerfile.function.amazonlinux | 2 +- .../test/integration/docker/Dockerfile.function.debian | 2 +- .../test/integration/docker/Dockerfile.function.ubuntu | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine index 6b21276c4..8dc101183 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine @@ -1,5 +1,5 @@ ARG BASE_REGISTRY=public.ecr.aws -ARG DISTRO_VERSION +ARG DISTRO_VERSION=3.15 FROM ${BASE_REGISTRY}/docker/library/alpine:${DISTRO_VERSION} diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto index 635bb3338..cb9c4727e 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto @@ -1,5 +1,5 @@ ARG BASE_REGISTRY=public.ecr.aws -ARG RUNTIME_VERSION +ARG RUNTIME_VERSION=11 FROM ${BASE_REGISTRY}/amazoncorretto/amazoncorretto:${RUNTIME_VERSION} diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux index b6ef31cb2..aa636f432 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux @@ -1,5 +1,5 @@ ARG BASE_REGISTRY=public.ecr.aws -ARG DISTRO_VERSION +ARG DISTRO_VERSION=2 FROM ${BASE_REGISTRY}/amazonlinux/amazonlinux:${DISTRO_VERSION} diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian index cc2f0f199..7310d3530 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian @@ -1,5 +1,5 @@ ARG BASE_REGISTRY=public.ecr.aws -ARG DISTRO_VERSION +ARG DISTRO_VERSION=bookworm FROM ${BASE_REGISTRY}/debian/debian:${DISTRO_VERSION} as build-image diff --git a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu index d77129255..0522ebc2d 100644 --- a/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu +++ b/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu @@ -1,5 +1,5 @@ ARG BASE_REGISTRY=public.ecr.aws -ARG DISTRO_VERSION +ARG DISTRO_VERSION=24.04 FROM ${BASE_REGISTRY}/ubuntu/ubuntu:${DISTRO_VERSION} as build-image