FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix os compatibility test local builds on arm64 hosts by zsombor-balogh · Pull Request #338 · aws/aws-lambda-java-libs · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .sh  (5) .yml  (7) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# This file is copied from https://github.com/aws/aws-codebuild-docker-images/blob/f0912e4b16e427da35351fc102f0f56f4ceb938a/local_builds/codebuild_build.sh
# This file is copied from https://github.com/aws/aws-codebuild-docker-images/blob/282c6634e8c83c2a9841719b09aabfced3461981/local_builds/codebuild_build.sh

function allOSRealPath() {
if isOSWindows
Expand Down Expand Up @@ -36,6 +36,7 @@ function usage {
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 <sourceIdentifier>:<sourceLocation> format for secondary source"
Expand All @@ -61,10 +62,11 @@ awsconfig_flag=false
mount_src_dir_flag=false
docker_privileged_mode_flag=false

while getopts "cmdi:a:s:b:e:l:p:h" opt; do
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;;
Expand Down Expand Up @@ -106,6 +108,11 @@ 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")\""
Expand Down Expand Up @@ -176,7 +183,12 @@ else
docker_command+=" -e \"INITIATOR=$USER\""
fi

docker_command+=" public.ecr.aws/codebuild/local-builds:latest"
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
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ function usage {
>&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."
Expand Down Expand Up @@ -48,7 +57,7 @@ main() {
echo "RUNTIME_VERSION=$RUNTIME_VERSION"
echo "PLATFORM=$PLATFORM"
} >> "$ENVFILE"

ARTIFACTS_DIR="$CODEBUILD_TEMP_DIR/artifacts"
mkdir -p "$ARTIFACTS_DIR"
# Run CodeBuild local agent.
Expand All @@ -57,7 +66,8 @@ main() {
-a "$ARTIFACTS_DIR" \
-e "$ENVFILE" \
-b "$BUILDSPEC_YML" \
-s "$(dirname $PWD)"
-s "$(dirname $PWD)" \
-l "$(get_local_agent_image)"
}

main "$@"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -79,49 +79,7 @@ phases:
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${OS_DISTRIBUTION}-network"
- >
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
- sleep 2
- >
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
- aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh
finally:
- |
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 "---------------------------------------------------"
- 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
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,49 +75,7 @@ phases:
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${OS_DISTRIBUTION}-network"
- >
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
- sleep 2
- >
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
- aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh
finally:
- |
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 "---------------------------------------------------"
- 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
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -61,49 +61,7 @@ phases:
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${OS_DISTRIBUTION}-network"
- >
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
- sleep 2
- >
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
- aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh
finally:
- |
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 "---------------------------------------------------"
- 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
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -74,49 +74,7 @@ phases:
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${OS_DISTRIBUTION}-network"
- >
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
- sleep 2
- >
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
- aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh
finally:
- |
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 "---------------------------------------------------"
- 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
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -74,49 +74,7 @@ phases:
--build-arg DISTRO_VERSION="${DISTRO_VERSION}"
build:
commands:
- set -x
- echo "Running Image ${IMAGE_TAG}"
- docker network create "${OS_DISTRIBUTION}-network"
- >
docker run \
--detach \
--name "${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c "/usr/bin/${RIE} ${JAVA_BINARY_LOCATION} -jar ./HelloWorld-1.0.jar helloworld.App"
- sleep 2
- >
docker run \
--name "${OS_DISTRIBUTION}-tester" \
--env "TARGET=${OS_DISTRIBUTION}-app" \
--network "${OS_DISTRIBUTION}-network" \
--entrypoint="" \
"${IMAGE_TAG}" \
sh -c 'curl -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
- actual="$(docker logs --tail 1 "${OS_DISTRIBUTION}-tester" | xargs)"
- expected='success'
- |
echo "Response: ${actual}"
if [[ "$actual" != "$expected" ]]; then
echo "fail! runtime: $RUNTIME - expected output $expected - got $actual"
exit -1
fi
- aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/run_invocation_test.sh
finally:
- |
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 "---------------------------------------------------"
- 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
- 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
Loading

Back | FazBrowse Home | New Git URL