forked from aws/aws-lambda-java-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.os.amazonlinux.1.yml
67 lines (66 loc) · 2.6 KB
/
buildspec.os.amazonlinux.1.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
version: 0.2
env:
variables:
OS_DISTRIBUTION: amazonlinux
JAVA_BINARY_LOCATION: "/usr/bin/java"
batch:
build-matrix:
static:
ignore-failure: false
env:
privileged-mode: true
dynamic:
env:
variables:
DISTRO_VERSION:
- "1"
RUNTIME_VERSION:
- "openjdk8"
PLATFORM:
- "linux/amd64"
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
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 -DmultiArch=false)
- (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}"
- >
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