Skip to content

Commit c6b416a

Browse files
authored
Stop building gcc from source, remove unnecessary user.dir overrides in CustomerClassLoaderTest, add glibc OS test in test-smoke (#194)
1 parent 4a434e4 commit c6b416a

File tree

4 files changed

+39
-58
lines changed

4 files changed

+39
-58
lines changed

aws-lambda-java-runtime-interface-client/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ setup-codebuild-agent:
1414
.PHONY: test-smoke
1515
test-smoke: setup-codebuild-agent
1616
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.12 corretto11
17+
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11
1718

1819
.PHONY: test-integ
1920
test-integ: setup-codebuild-agent

aws-lambda-java-runtime-interface-client/src/main/jni/Dockerfile.glibc

+20-32
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,27 @@
11
# we use centos 7 to build against glibc 2.17
22
FROM centos:7
33

4+
# Add Corretto repository
5+
RUN rpm --import https://yum.corretto.aws/corretto.key && \
6+
curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
7+
48
# aws-lambda-cpp requires cmake3, it's available in EPEL
59
RUN yum install -y epel-release
610
RUN yum install -y \
7-
cmake3 \
8-
make \
9-
gcc \
10-
gcc-c++ \
11-
glibc-devel \
12-
gmp-devel \
13-
libmpc-devel \
14-
libtool \
15-
mpfr-devel \
16-
wget
17-
18-
# aws-lambda-cpp also needs a newer compiler than the default gcc 4.4
19-
ARG GCC_VERSION=4.8.5
20-
RUN wget -qO- https://mirrors.kernel.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz | tar xzf -
21-
WORKDIR gcc-$GCC_VERSION
22-
RUN ./configure \
23-
--disable-multilib \
24-
--enable-languages=c,c++ && \
25-
make -j$(nproc) && \
26-
make install
27-
RUN yum remove -y gcc gcc-c++
28-
RUN rm -rf /usr/bin/gcc && \
29-
rm -rf /usr/bin/c++ && \
30-
rm -rf /usr/bin/cc && \
31-
ln -s /usr/local/bin/x86_64-unknown-linux-gnu-gcc-$GCC_VERSION /usr/bin/gcc && \
32-
ln -s /usr/local/bin/x86_64-unknown-linux-gnu-c++ /usr/bin/c++ && \
33-
ln -s /usr/local/bin/x86_64-unknown-linux-gnu-gcc /usr/bin/cc
34-
35-
RUN rpm --import https://yum.corretto.aws/corretto.key
36-
RUN curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
37-
RUN yum install -y java-1.8.0-amazon-corretto-devel
11+
cmake3 \
12+
make \
13+
gcc \
14+
gcc-c++ \
15+
libstdc++-static \
16+
glibc-devel \
17+
gmp-devel \
18+
libmpc-devel \
19+
libtool \
20+
mpfr-devel \
21+
wget \
22+
java-1.8.0-amazon-corretto-devel
3823

24+
# Install curl dependency
3925
ADD ./deps/curl-* /src/deps/curl
4026
WORKDIR /src/deps/curl
4127
RUN ./configure \
@@ -46,6 +32,7 @@ RUN ./configure \
4632
make && \
4733
make install
4834

35+
# Install aws-lambda-cpp dependency
4936
ADD ./deps/aws-lambda-cpp-* /src/deps/aws-lambda-cpp
5037
RUN sed -i.bak 's/VERSION 3.9/VERSION 3.6/' /src/deps/aws-lambda-cpp/CMakeLists.txt
5138
RUN mkdir -p /src/deps/aws-lambda-cpp/build
@@ -54,11 +41,12 @@ RUN cmake3 .. \
5441
-DENABLE_LTO=OFF \
5542
-DCMAKE_CXX_FLAGS="-fPIC -DBACKWARD_SYSTEM_UNKNOWN" \
5643
-DCMAKE_CXX_STANDARD=11 \
57-
-DCMAKE_INSTALL_PREFIX=$(pwd)/../../artifacts\
44+
-DCMAKE_INSTALL_PREFIX=$(pwd)/../../artifacts \
5845
-DCMAKE_MODULE_PATH=$(pwd)/../../artifacts/lib/pkgconfig && \
5946
make && \
6047
make install
6148

49+
# Build native client
6250
ADD *.cpp *.h /src/
6351
WORKDIR /src
6452
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto

aws-lambda-java-runtime-interface-client/src/main/jni/Dockerfile.musl

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
FROM alpine:3
2-
RUN wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub
3-
RUN echo "https://apk.corretto.aws/" >> /etc/apk/repositories
4-
RUN apk update
5-
RUN apk add \
6-
amazon-corretto-8 \
7-
cmake \
8-
file \
9-
g++ \
10-
gcc \
11-
make \
12-
libexecinfo-dev \
13-
perl
142

3+
# Add Corretto repository
4+
RUN wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub && \
5+
echo "https://apk.corretto.aws/" >> /etc/apk/repositories
6+
7+
RUN apk update && \
8+
apk add \
9+
amazon-corretto-8 \
10+
cmake \
11+
file \
12+
g++ \
13+
gcc \
14+
make \
15+
libexecinfo-dev \
16+
perl
17+
18+
# Install curl dependency
1519
ADD ./deps/curl-* /src/deps/curl
1620
WORKDIR /src/deps/curl
1721
RUN ./configure \
@@ -22,6 +26,7 @@ RUN ./configure \
2226
make && \
2327
make install
2428

29+
# Install aws-lambda-cpp dependency
2530
ADD ./deps/aws-lambda-cpp-* /src/deps/aws-lambda-cpp
2631
RUN mkdir -p /src/deps/aws-lambda-cpp/build
2732
WORKDIR /src/deps/aws-lambda-cpp/build
@@ -33,6 +38,7 @@ RUN cmake .. \
3338
make && \
3439
make install
3540

41+
# Build native client
3642
ADD *.cpp *.h /src/
3743
WORKDIR /src
3844
ENV JAVA_HOME=/usr/lib/jvm/java-8-amazon-corretto

aws-lambda-java-runtime-interface-client/src/test/java/com/amazonaws/services/lambda/runtime/api/client/CustomerClassLoaderTest.java

-14
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
package com.amazonaws.services.lambda.runtime.api.client;
44

5-
import org.junit.jupiter.api.AfterEach;
65
import org.junit.jupiter.api.Assertions;
7-
import org.junit.jupiter.api.BeforeEach;
86
import org.junit.jupiter.api.Test;
97
import org.junit.jupiter.api.condition.DisabledOnOs;
108

@@ -20,18 +18,6 @@
2018
import static org.junit.jupiter.api.condition.OS.MAC;
2119

2220
public class CustomerClassLoaderTest {
23-
private static final String USER_WORKING_DIR = "user/path";
24-
private static final String ORIGINAL_WORKING_DIR = System.getProperty("user.dir");
25-
26-
@BeforeEach
27-
public void before() {
28-
System.setProperty("user.dir", USER_WORKING_DIR);
29-
}
30-
31-
@AfterEach
32-
public void after() {
33-
System.setProperty("user.dir", ORIGINAL_WORKING_DIR);
34-
}
3521

3622
final static String[] EXAMPLE_FUNCTION = new String[]{
3723
"var/runtime/lib/LambdaJavaRTEntry-1.0.jar",

0 commit comments

Comments
 (0)