Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] otel-webserver add support for arm64 #400

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 138 additions & 1 deletion .github/workflows/webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,76 @@ jobs:
rm -rf /tmp/buildx-cache/apache_ubuntu
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu

webserver-build-test-ubuntu-arm64:
name: webserver-ubuntu-build-arm64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@master
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/arm64
- name: cache docker layers
uses: actions/cache@v3
with:
path: /tmp/buildx-cache/
key: apache-ubuntu-20.04-${{ github.sha }}
restore-keys: |
apache-ubuntu-20.04
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04-arm64/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
--load . --platform linux/arm64
- name: build
run: |
docker run -idt --platform linux/arm64 --name apache_ubuntu_container_arm64 apache_ubuntu_arm64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_ubuntu_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_arm64):/otel-webserver-module/
docker exec apache_ubuntu_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \

./gradlew assembleWebServerModule -DtargetSystem=ubuntu'
# - name: unit test
# run: |
# docker exec apache_ubuntu_container_arm64 bash -c \
# 'cd /otel-webserver-module; ./gradlew runUnitTest'
- name: update cache
run: |
rm -rf /tmp/buildx-cache/apache_ubuntu_arm64
mv /tmp/buildx-cache/apache_ubuntu_arm64-new /tmp/buildx-cache/apache_ubuntu_arm64
# - name: copy artifacts
# id: artifacts
# run: |
# cd instrumentation/otel-webserver-module
# mkdir -p /tmp/apache_ubuntu_arm64/
# docker cp apache_ubuntu_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
# /tmp/apache_ubuntu_arm64/
# - name: upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: opentelemetry-webserver-sdk-arm64-linux.tgz
# path: /tmp/apache_ubuntu_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
# - name: run integrationtest
# run: |
# docker rm -f apache_ubuntu_container_arm64
# cd instrumentation/otel-webserver-module
# docker compose --profile ubuntu20.04 up -d
# docker ps -a
# sleep 30
# ./gradlew :test:integration:integrationTests -i

webserver-build-test-centos7:
name: webserver-centos7-build
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -116,7 +186,74 @@ jobs:
run: |
docker rm -f apache_centos7_container
cd instrumentation/otel-webserver-module
docker-compose --profile centos7 up -d
docker compose --profile centos7 up -d
docker ps -a
sleep 30
./gradlew :test:integration:integrationTests -i

webserver-build-test-centos7-arm64:
name: webserver-centos7-build-arm64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@master
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/arm64
# - name: cache docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/buildx-cache/
# key: apache-centos7-${{ github.sha }}
# restore-keys: |
# apache-centos7
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_centos7_arm64 -f docker/centos7-arm64/Dockerfile \
--load . --platform linux/arm64
- name: build
run: |
docker run -idt --platform linux/arm64 --name apache_centos7_container_arm64 apache_centos7_arm64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_arm64):/otel-webserver-module/
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
./gradlew assembleWebServerModule'
- name: unit test
run: |
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; ./gradlew runUnitTest'
# - name: update cache
# run: |
# rm -rf /tmp/buildx-cache/apache_centos7_arm64
# mv /tmp/buildx-cache/apache_centos7_arm64-new /tmp/buildx-cache/apache_centos7_arm64
- name: copy artifacts
id: artifacts
run: |
cd instrumentation/otel-webserver-module
mkdir -p /tmp/apache_centos7_arm64/
docker cp apache_centos7_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
/tmp/apache_centos7_arm64/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: opentelemetry-webserver-sdk-arm64-linux.tgz
path: /tmp/apache_centos7_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
- name: run integrationtest
run: |
docker rm -f apache_centos7_container_arm64
cd instrumentation/otel-webserver-module
docker compose --profile centos7 up -d
docker ps -a
sleep 30
./gradlew :test:integration:integrationTests -i
Expand Down
9 changes: 6 additions & 3 deletions instrumentation/otel-webserver-module/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ project.ext {

ansdkOsName = osName
ansdkArch = (osArch == 'x86' ? 'i686' : osArch)
gccArchFlag = (osArch == 'x86' ? '-m32' : '-m64')
gccArchFlag = (osArch == 'x86' ? '-m32' : (osArch == 'arm64' ? '-march=armv8-a' : '-m64'))
headSHA1 = "<dev>"

try {
Expand Down Expand Up @@ -499,7 +499,7 @@ task gypUnitTest(type: Exec) {
ANSDK_DIR: modDepDir,
BOOST_LIB: BOOST_LIB,
BOOST_INCLUDE: BOOST_INCLUDE,
GTEST_LIB_DIR: target_system == "ubuntu" ?
GTEST_LIB_DIR: target_system == "ubuntu" || osArch == "arm64" ?
"${modDepDir}/googletest/1.10.0/lib" : "${modDepDir}/googletest/1.10.0/lib64",
LIBRARY_FLAGS: libraryFlags,
CPP_SDK_VERSION: cppSDKVersion,
Expand Down Expand Up @@ -536,7 +536,7 @@ task runApacheServer(type: Exec) {
dependsOn assembleApacheModule

workingDir 'test'
commandLine './ApacheTesting.sh', "${target_system}"
commandLine './ApacheTesting.sh', "${target_system}", "${osArch}"
}

// Code Coverage
Expand Down Expand Up @@ -602,6 +602,9 @@ model {
release
}
platforms {
arm {
architecture "arm64"
}
x86 {
architecture "x86"
}
Expand Down
5 changes: 5 additions & 0 deletions instrumentation/otel-webserver-module/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ defaultTasks 'build'
ext {
ARCH = ''
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere? I think I've added a case statement to have it work for ARM64

switch (System.properties['os.arch'].toLowerCase()) {
case "aarch64":
ARCH = "arm64"
break
case "amd64":
case "x86_64":
ARCH = "x64"
Expand Down Expand Up @@ -42,6 +45,8 @@ ext {
osArch = 'x86'
} else if (osArch == 'x86_64' || osArch == 'amd64') {
osArch = 'x64'
} else if (osArch == 'aarch64') {
osArch = 'arm64'
}

BUILD_SHA1 = System.getenv('BUILD_SHA')
Expand Down
64 changes: 64 additions & 0 deletions instrumentation/otel-webserver-module/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ services:
- "9004:80"
depends_on:
- otel-collector
webserver_centos7-arm64:
build:
context: .
dockerfile: docker/centos7-arm64/Dockerfile
platforms:
- "linux/arm64"
image: apache_centos7_arm64
hostname: webserver
container_name: webserver_centos7_arm64
command: bash -c " httpd -k start && tail -f /dev/null "
profiles:
- centos7
ports:
- "9004:80"
depends_on:
- otel-collector
webserver_ubuntu:
build:
context: .
Expand All @@ -43,6 +59,22 @@ services:
- "9000:80"
depends_on:
- otel-collector
webserver_ubuntu-arm64:
build:
context: .
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
platforms:
- "linux/arm64"
image: apache_ubuntu_arm64
hostname: webserver
container_name: webserver_ubuntu_arm64
command: bash -c "apache2ctl -k start && tail -f /dev/null "
profiles:
- ubuntu20.04
ports:
- "9000:80"
depends_on:
- otel-collector
nginx_centos:
build:
context: .
Expand Down Expand Up @@ -71,6 +103,22 @@ services:
- "8012:80"
depends_on:
- otel-collector
nginx_centos7-arm64:
build:
context: .
dockerfile: docker/centos7/Dockerfile
platforms:
- "linux/arm64"
image: nginx_centos7_arm64
hostname: webserver
container_name: nginx_centos7_arm64
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
profiles:
- centos7_nginx
ports:
- "8012:80"
depends_on:
- otel-collector
nginx_ubuntu:
build:
context: .
Expand All @@ -85,6 +133,22 @@ services:
- "8016:80"
depends_on:
- otel-collector
nginx_ubuntu-arm64:
build:
context: .
dockerfile: docker/ubuntu20.04-arm64/Dockerfile
platforms:
- "linux/arm64"
image: nginx_ubuntu_arm64
hostname: webserver
container_name: nginx_ubuntu_arm64
command: bash -c "export LD_LIBRARY_PATH=/opt/opentelemetry-webserver-sdk/sdk_lib/lib && nginx && tail -f /dev/null"
profiles:
- ubuntu20.04_nginx
ports:
- "8016:80"
depends_on:
- otel-collector


# Collector
Expand Down
Loading
Loading