Skip to content

Commit f7e0a28

Browse files
committed
otel-webserver support for arm64
1 parent e11348b commit f7e0a28

File tree

10 files changed

+247
-65
lines changed

10 files changed

+247
-65
lines changed

.github/workflows/webserver.yml

Lines changed: 168 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- '.github/workflows/webserver.yml'
1414

1515
jobs:
16-
webserver-build-test-ubuntu:
17-
name: webserver-ubuntu-build
16+
webserver-build-test-ubuntu-x64:
17+
name: webserver-ubuntu-build-x64
1818
runs-on: ubuntu-20.04
1919
steps:
2020
- name: checkout otel webserver
@@ -24,6 +24,7 @@ jobs:
2424
uses: docker/setup-buildx-action@master
2525
with:
2626
install: true
27+
platforms: linux/amd64
2728
- name: cache docker layers
2829
uses: actions/cache@v3
2930
with:
@@ -34,18 +35,18 @@ jobs:
3435
- name: setup docker image
3536
run: |
3637
cd instrumentation/otel-webserver-module
37-
docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \
38-
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \
39-
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \
38+
docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \
39+
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \
40+
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \
4041
--load .
4142
- name: build
4243
run: |
43-
docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash
44+
docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash
4445
cd instrumentation/otel-webserver-module
45-
docker exec apache_ubuntu_container bash -c \
46+
docker exec apache_ubuntu_container_amd64 bash -c \
4647
'cd /otel-webserver-module; rm -rf *;'
47-
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/
48-
docker exec apache_ubuntu_container bash -c \
48+
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/
49+
docker exec apache_ubuntu_container_amd64 bash -c \
4950
'cd /otel-webserver-module; rm -rf build; \
5051
cp -r /dependencies /otel-webserver-module/; \
5152
cp -r /build-dependencies /otel-webserver-module/; \
@@ -54,20 +55,91 @@ jobs:
5455
5556
- name: update cache
5657
run: |
57-
rm -rf /tmp/buildx-cache/apache_ubuntu
58-
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu
58+
rm -rf /tmp/buildx-cache/apache_ubuntu_amd64
59+
mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64
5960
60-
webserver-build-test-centos7:
61-
name: webserver-centos7-build
61+
webserver-build-test-ubuntu-arm64:
62+
name: webserver-ubuntu-build-arm64
6263
runs-on: ubuntu-20.04
6364
steps:
6465
- name: checkout otel webserver
6566
uses: actions/checkout@v3
67+
- name: setup qemu
68+
uses: docker/setup-qemu-action@master
6669
- name: setup buildx
6770
id: buildx
6871
uses: docker/setup-buildx-action@master
6972
with:
7073
install: true
74+
platforms: linux/arm64
75+
- name: cache docker layers
76+
uses: actions/cache@v3
77+
with:
78+
path: /tmp/buildx-cache/
79+
key: apache-ubuntu-20.04-${{ github.sha }}
80+
restore-keys: |
81+
apache-ubuntu-20.04
82+
- name: setup docker image
83+
run: |
84+
cd instrumentation/otel-webserver-module
85+
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04/Dockerfile \
86+
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
87+
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
88+
--load . --platform linux/arm64
89+
- name: build
90+
run: |
91+
docker run -idt --platform linux/arm64 --name apache_ubuntu_container_arm64 apache_ubuntu_arm64 /bin/bash
92+
cd instrumentation/otel-webserver-module
93+
docker exec apache_ubuntu_container_arm64 bash -c \
94+
'cd /otel-webserver-module; rm -rf *;'
95+
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_arm64):/otel-webserver-module/
96+
docker exec apache_ubuntu_container_arm64 bash -c \
97+
'cd /otel-webserver-module; rm -rf build; \
98+
cp -r /dependencies /otel-webserver-module/; \
99+
cp -r /build-dependencies /otel-webserver-module/; \
100+
101+
./gradlew assembleWebServerModule -DtargetSystem=ubuntu'
102+
# - name: unit test
103+
# run: |
104+
# docker exec apache_ubuntu_container_arm64 bash -c \
105+
# 'cd /otel-webserver-module; ./gradlew runUnitTest'
106+
- name: update cache
107+
run: |
108+
rm -rf /tmp/buildx-cache/apache_ubuntu_arm64
109+
mv /tmp/buildx-cache/apache_ubuntu_arm64-new /tmp/buildx-cache/apache_ubuntu_arm64
110+
# - name: copy artifacts
111+
# id: artifacts
112+
# run: |
113+
# cd instrumentation/otel-webserver-module
114+
# mkdir -p /tmp/apache_ubuntu_arm64/
115+
# docker cp apache_ubuntu_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
116+
# /tmp/apache_ubuntu_arm64/
117+
# - name: upload artifacts
118+
# uses: actions/upload-artifact@v3
119+
# with:
120+
# name: opentelemetry-webserver-sdk-arm64-linux.tgz
121+
# path: /tmp/apache_ubuntu_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
122+
# - name: run integrationtest
123+
# run: |
124+
# docker rm -f apache_ubuntu_container_arm64
125+
# cd instrumentation/otel-webserver-module
126+
# docker compose --profile ubuntu20.04 up -d
127+
# docker ps -a
128+
# sleep 30
129+
# ./gradlew :test:integration:integrationTests -i
130+
131+
webserver-build-test-centos7-x64:
132+
name: webserver-centos7-build-x64
133+
runs-on: ubuntu-20.04
134+
steps:
135+
- name: checkout otel webserver
136+
uses: actions/checkout@v3
137+
- name: setup buildx
138+
id: buildx
139+
uses: docker/setup-buildx-action@master
140+
with:
141+
install: true
142+
platforms: linux/amd64
71143
# - name: cache docker layers
72144
# uses: actions/cache@v3
73145
# with:
@@ -78,45 +150,114 @@ jobs:
78150
- name: setup docker image
79151
run: |
80152
cd instrumentation/otel-webserver-module
81-
docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \
153+
docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \
82154
--load .
83155
- name: build
84156
run: |
85-
docker run -idt --name apache_centos7_container apache_centos7 /bin/bash
157+
docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash
86158
cd instrumentation/otel-webserver-module
87-
docker exec apache_centos7_container bash -c \
159+
docker exec apache_centos7_container_amd64 bash -c \
88160
'cd /otel-webserver-module; rm -rf *;'
89-
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/
90-
docker exec apache_centos7_container bash -c \
161+
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/
162+
docker exec apache_centos7_container_amd64 bash -c \
91163
'cd /otel-webserver-module; rm -rf build; \
92164
cp -r /dependencies /otel-webserver-module/; \
93165
cp -r /build-dependencies /otel-webserver-module/; \
94166
./gradlew assembleWebServerModule'
95167
- name: unit test
96168
run: |
97-
docker exec apache_centos7_container bash -c \
169+
docker exec apache_centos7_container_amd64 bash -c \
98170
'cd /otel-webserver-module; ./gradlew runUnitTest'
99171
# - name: update cache
100172
# run: |
101-
# rm -rf /tmp/buildx-cache/apache_centos7
102-
# mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7
173+
# rm -rf /tmp/buildx-cache/apache_centos7_amd64
174+
# mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64
103175
- name: copy artifacts
104176
id: artifacts
105177
run: |
106178
cd instrumentation/otel-webserver-module
107-
mkdir -p /tmp/apache_centos7/
108-
docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
109-
/tmp/apache_centos7/
179+
mkdir -p /tmp/apache_centos7_amd64/
180+
docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
181+
/tmp/apache_centos7_amd64/
110182
- name: upload artifacts
111183
uses: actions/upload-artifact@v3
112184
with:
113185
name: opentelemetry-webserver-sdk-x64-linux.tgz
114-
path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz
186+
path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz
187+
- name: run integrationtest
188+
run: |
189+
docker rm -f apache_centos7_container_amd64
190+
cd instrumentation/otel-webserver-module
191+
docker compose --profile centos7 up -d
192+
docker ps -a
193+
sleep 30
194+
./gradlew :test:integration:integrationTests -i
195+
196+
webserver-build-test-centos7-arm64:
197+
name: webserver-centos7-build-arm64
198+
runs-on: ubuntu-20.04
199+
steps:
200+
- name: checkout otel webserver
201+
uses: actions/checkout@v3
202+
- name: setup qemu
203+
uses: docker/setup-qemu-action@master
204+
- name: setup buildx
205+
id: buildx
206+
uses: docker/setup-buildx-action@master
207+
with:
208+
install: true
209+
platforms: linux/arm64
210+
# - name: cache docker layers
211+
# uses: actions/cache@v3
212+
# with:
213+
# path: /tmp/buildx-cache/
214+
# key: apache-centos7-${{ github.sha }}
215+
# restore-keys: |
216+
# apache-centos7
217+
- name: setup docker image
218+
run: |
219+
cd instrumentation/otel-webserver-module
220+
docker buildx build -t apache_centos7_arm64 -f docker/centos7/Dockerfile \
221+
--load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \
222+
--build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \
223+
--build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64'
224+
- name: build
225+
run: |
226+
docker run -idt --platform linux/arm64 --name apache_centos7_container_arm64 apache_centos7_arm64 /bin/bash
227+
cd instrumentation/otel-webserver-module
228+
docker exec apache_centos7_container_arm64 bash -c \
229+
'cd /otel-webserver-module; rm -rf *;'
230+
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_arm64):/otel-webserver-module/
231+
docker exec apache_centos7_container_arm64 bash -c \
232+
'cd /otel-webserver-module; rm -rf build; \
233+
cp -r /dependencies /otel-webserver-module/; \
234+
cp -r /build-dependencies /otel-webserver-module/; \
235+
./gradlew assembleWebServerModule'
236+
- name: unit test
237+
run: |
238+
docker exec apache_centos7_container_arm64 bash -c \
239+
'cd /otel-webserver-module; ./gradlew runUnitTest'
240+
# - name: update cache
241+
# run: |
242+
# rm -rf /tmp/buildx-cache/apache_centos7_arm64
243+
# mv /tmp/buildx-cache/apache_centos7_arm64-new /tmp/buildx-cache/apache_centos7_arm64
244+
- name: copy artifacts
245+
id: artifacts
246+
run: |
247+
cd instrumentation/otel-webserver-module
248+
mkdir -p /tmp/apache_centos7_arm64/
249+
docker cp apache_centos7_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
250+
/tmp/apache_centos7_arm64/
251+
- name: upload artifacts
252+
uses: actions/upload-artifact@v3
253+
with:
254+
name: opentelemetry-webserver-sdk-arm64-linux.tgz
255+
path: /tmp/apache_centos7_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
115256
- name: run integrationtest
116257
run: |
117-
docker rm -f apache_centos7_container
258+
docker rm -f apache_centos7_container_arm64
118259
cd instrumentation/otel-webserver-module
119-
docker-compose --profile centos7 up -d
260+
docker compose --profile centos7 up -d
120261
docker ps -a
121262
sleep 30
122263
./gradlew :test:integration:integrationTests -i

instrumentation/otel-webserver-module/Dockerfile

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
FROM centos:6.9
22

33
ARG BUILD_NUMBER
4+
ARG BUILD_ARCH='x64'
45

5-
LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER
6+
LABEL NAME=apm/build-image-webserver-agent-centos6-${BUILD_ARCH} VERSION=$BUILD_NUMBER
67

7-
ENV GOSU_ARCH amd64
8-
ENV JDK_ARCH x64
8+
ARG GOSU_ARCH='amd64'
9+
ENV GOSU_ARCH=${GOSU_ARCH}
10+
ARG JDK_ARCH='x64'
11+
ENV JDK_ARCH=${JDK_ARCH}
912

10-
ARG PYTHON_VERSION="2.7.8"
13+
ARG PYTHON_VERSION="2.7.18"
14+
ARG CMAKE_ARCH='x86_64'
1115
ARG CMAKE_VERSION="3.20"
1216
ARG CMAKE_0VERSION="3.20.0"
1317
ARG GRPC_VERSION="1.36.4"
@@ -18,12 +22,14 @@ ARG APR_VERSION="1.7.0"
1822
ARG EXPAT_VERSION="2.3.0"
1923
ARG EXPAT_RVERSION="R_2_3_0"
2024
ARG APRUTIL_VERSION="1.6.1"
25+
ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu'
2126
ARG AUTOCONF_VERSION="2.68"
2227
ARG LIBTOOL_VERSION="2.4.6"
2328
ARG LOG4CXX_VERSION="0.11.0"
2429
ARG GTEST_VERSION="1.10.0"
2530
ARG AUTOMAKE_VERSION="1.16.3"
2631
ARG PCRE_VERSION="8.44"
32+
ARG NGINX_ARCH='x86_64'
2733
ARG NGINX_VERSION="1.26.0"
2834

2935

@@ -73,9 +79,9 @@ RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERS
7379
&& rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar
7480

7581
# install gosu for easy step-down from root (from https://github.com/tianon/gosu/blob/master/INSTALL.md#from-centos)
76-
ENV GOSU_VERSION=1.10
82+
ENV GOSU_VERSION=1.11
7783

78-
RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
84+
RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \
7985
&& chmod +x /usr/bin/gosu \
8086
# Verify that the binary works
8187
&& gosu nobody true
@@ -85,11 +91,11 @@ RUN yum install git -y \
8591
&& yum clean all
8692

8793
# install cmake
88-
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
89-
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
90-
&& cd cmake-${CMAKE_0VERSION}-linux-x86_64 \
94+
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
95+
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
96+
&& cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \
9197
&& cp -rf * /usr/local/ \
92-
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz
98+
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz
9399

94100
# install grpc. If planning to upgrade, make sure sed command works
95101
RUN git clone https://github.com/grpc/grpc \
@@ -152,7 +158,7 @@ RUN yum install m4 -y
152158
RUN wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz \
153159
&& tar xzf autoconf-${AUTOCONF_VERSION}.tar.gz \
154160
&& cd autoconf-${AUTOCONF_VERSION} \
155-
&& ./configure --prefix=/usr/ && make -j && make install && autoconf -V \
161+
&& ./configure --prefix=/usr/ --build=${AUTOCONF_BUILD_TYPE} && make -j && make install && autoconf -V \
156162
&& cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz
157163

158164
# install automake
@@ -257,13 +263,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \
257263

258264
RUN echo '[nginx]' >> /etc/yum.repos.d/nginx.repo \
259265
&& echo 'name=nginx repo' >> /etc/yum.repos.d/nginx.repo \
260-
&& echo 'baseurl=https://nginx.org/packages/centos/6/x86_64' >> /etc/yum.repos.d/nginx.repo \
266+
&& echo "baseurl=https://nginx.org/packages/centos/6/${NGINX_ARCH}" >> /etc/yum.repos.d/nginx.repo \
261267
&& echo 'gpgcheck=0' >> /etc/yum.repos.d/nginx.repo \
262268
&& echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \
263269
&& yum install nginx -y
264270

265271
RUN cd /otel-webserver-module/build \
266-
&& tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \
272+
&& tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \
267273
&& mv -f opentelemetry-webserver-sdk /opt/ \
268274
&& cd ../ \
269275
&& cp opentelemetry_module.conf /etc/httpd/conf/ \
@@ -278,7 +284,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \
278284
&& cd /
279285

280286
# Remove unwanted files
281-
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \
287+
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \
282288
&& rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \
283289
&& rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \
284290
&& rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz

0 commit comments

Comments
 (0)