forked from aws/aws-lambda-java-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.os.amazoncorretto.yml
81 lines (80 loc) · 3.14 KB
/
buildspec.os.amazoncorretto.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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:
build-matrix:
static:
ignore-failure: false
env:
privileged-mode: true
dynamic:
env:
variables:
DISTRO_VERSION:
- "amazoncorretto"
RUNTIME_VERSION:
- "8"
- "11"
PLATFORM:
- "linux/amd64"
- "linux/arm64/v8"
phases:
install:
commands:
- >
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
then
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
else
echo "Performing DockerHub login . . ."
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
fi
- 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-serialization && mvn install)
- (cd aws-lambda-java-runtime-interface-client && mvn install)
- (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}"
- >
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