diff --git a/.github/workflows/webserver.yml b/.github/workflows/webserver.yml index 30056d472..1cc8c5a55 100644 --- a/.github/workflows/webserver.yml +++ b/.github/workflows/webserver.yml @@ -13,8 +13,8 @@ on: - '.github/workflows/webserver.yml' jobs: - webserver-build-test-ubuntu: - name: webserver-ubuntu-build + webserver-build-test-ubuntu-x64: + name: webserver-ubuntu-build-x64 runs-on: ubuntu-20.04 steps: - name: checkout otel webserver @@ -24,6 +24,7 @@ jobs: uses: docker/setup-buildx-action@master with: install: true + platforms: linux/amd64 - name: cache docker layers uses: actions/cache@v3 with: @@ -34,18 +35,18 @@ jobs: - name: setup docker image run: | cd instrumentation/otel-webserver-module - docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \ - --cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \ - --cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \ + docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \ + --cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \ + --cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \ --load . - name: build run: | - docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash + docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash cd instrumentation/otel-webserver-module - docker exec apache_ubuntu_container bash -c \ + docker exec apache_ubuntu_container_amd64 bash -c \ 'cd /otel-webserver-module; rm -rf *;' - docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/ - docker exec apache_ubuntu_container bash -c \ + docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/ + docker exec apache_ubuntu_container_amd64 bash -c \ 'cd /otel-webserver-module; rm -rf build; \ cp -r /dependencies /otel-webserver-module/; \ cp -r /build-dependencies /otel-webserver-module/; \ @@ -54,20 +55,91 @@ jobs: - name: update cache run: | - rm -rf /tmp/buildx-cache/apache_ubuntu - mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu + rm -rf /tmp/buildx-cache/apache_ubuntu_amd64 + mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64 - webserver-build-test-centos7: - name: webserver-centos7-build + 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/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-x64: + name: webserver-centos7-build-x64 + runs-on: ubuntu-20.04 + steps: + - name: checkout otel webserver + uses: actions/checkout@v3 + - name: setup buildx + id: buildx + uses: docker/setup-buildx-action@master + with: + install: true + platforms: linux/amd64 # - name: cache docker layers # uses: actions/cache@v3 # with: @@ -78,45 +150,114 @@ jobs: - name: setup docker image run: | cd instrumentation/otel-webserver-module - docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \ + docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \ --load . - name: build run: | - docker run -idt --name apache_centos7_container apache_centos7 /bin/bash + docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash cd instrumentation/otel-webserver-module - docker exec apache_centos7_container bash -c \ + docker exec apache_centos7_container_amd64 bash -c \ 'cd /otel-webserver-module; rm -rf *;' - docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/ - docker exec apache_centos7_container bash -c \ + docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/ + docker exec apache_centos7_container_amd64 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 bash -c \ + docker exec apache_centos7_container_amd64 bash -c \ 'cd /otel-webserver-module; ./gradlew runUnitTest' # - name: update cache # run: | - # rm -rf /tmp/buildx-cache/apache_centos7 - # mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7 + # rm -rf /tmp/buildx-cache/apache_centos7_amd64 + # mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64 - name: copy artifacts id: artifacts run: | cd instrumentation/otel-webserver-module - mkdir -p /tmp/apache_centos7/ - docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \ - /tmp/apache_centos7/ + mkdir -p /tmp/apache_centos7_amd64/ + docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \ + /tmp/apache_centos7_amd64/ - name: upload artifacts uses: actions/upload-artifact@v3 with: name: opentelemetry-webserver-sdk-x64-linux.tgz - path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz + path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz + - name: run integrationtest + run: | + docker rm -f apache_centos7_container_amd64 + cd instrumentation/otel-webserver-module + 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/Dockerfile \ + --load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \ + --build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \ + --build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64' + - 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 + docker rm -f apache_centos7_container_arm64 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 diff --git a/instrumentation/otel-webserver-module/Dockerfile b/instrumentation/otel-webserver-module/Dockerfile index 6deb7207a..7979a74e1 100644 --- a/instrumentation/otel-webserver-module/Dockerfile +++ b/instrumentation/otel-webserver-module/Dockerfile @@ -1,13 +1,17 @@ FROM centos:6.9 ARG BUILD_NUMBER +ARG BUILD_ARCH='x64' -LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER +LABEL NAME=apm/build-image-webserver-agent-centos6-${BUILD_ARCH} VERSION=$BUILD_NUMBER -ENV GOSU_ARCH amd64 -ENV JDK_ARCH x64 +ARG GOSU_ARCH='amd64' +ENV GOSU_ARCH=${GOSU_ARCH} +ARG JDK_ARCH='x64' +ENV JDK_ARCH=${JDK_ARCH} -ARG PYTHON_VERSION="2.7.8" +ARG PYTHON_VERSION="2.7.18" +ARG CMAKE_ARCH='x86_64' ARG CMAKE_VERSION="3.20" ARG CMAKE_0VERSION="3.20.0" ARG GRPC_VERSION="1.36.4" @@ -18,12 +22,14 @@ ARG APR_VERSION="1.7.0" ARG EXPAT_VERSION="2.3.0" ARG EXPAT_RVERSION="R_2_3_0" ARG APRUTIL_VERSION="1.6.1" +ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu' ARG AUTOCONF_VERSION="2.68" ARG LIBTOOL_VERSION="2.4.6" ARG LOG4CXX_VERSION="0.11.0" ARG GTEST_VERSION="1.10.0" ARG AUTOMAKE_VERSION="1.16.3" ARG PCRE_VERSION="8.44" +ARG NGINX_ARCH='x86_64' ARG NGINX_VERSION="1.26.0" @@ -73,9 +79,9 @@ RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERS && rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar # install gosu for easy step-down from root (from https://github.com/tianon/gosu/blob/master/INSTALL.md#from-centos) -ENV GOSU_VERSION=1.10 +ENV GOSU_VERSION=1.11 -RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \ +RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \ && chmod +x /usr/bin/gosu \ # Verify that the binary works && gosu nobody true @@ -85,11 +91,11 @@ RUN yum install git -y \ && yum clean all # install cmake -RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \ - && tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \ - && cd cmake-${CMAKE_0VERSION}-linux-x86_64 \ +RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \ + && tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \ + && cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \ && cp -rf * /usr/local/ \ - && cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz + && cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz # install grpc. If planning to upgrade, make sure sed command works RUN git clone https://github.com/grpc/grpc \ @@ -152,7 +158,7 @@ RUN yum install m4 -y RUN wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz \ && tar xzf autoconf-${AUTOCONF_VERSION}.tar.gz \ && cd autoconf-${AUTOCONF_VERSION} \ - && ./configure --prefix=/usr/ && make -j && make install && autoconf -V \ + && ./configure --prefix=/usr/ --build=${AUTOCONF_BUILD_TYPE} && make -j && make install && autoconf -V \ && cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz # install automake @@ -257,13 +263,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \ RUN echo '[nginx]' >> /etc/yum.repos.d/nginx.repo \ && echo 'name=nginx repo' >> /etc/yum.repos.d/nginx.repo \ - && echo 'baseurl=https://nginx.org/packages/centos/6/x86_64' >> /etc/yum.repos.d/nginx.repo \ + && echo "baseurl=https://nginx.org/packages/centos/6/${NGINX_ARCH}" >> /etc/yum.repos.d/nginx.repo \ && echo 'gpgcheck=0' >> /etc/yum.repos.d/nginx.repo \ && echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \ && yum install nginx -y RUN cd /otel-webserver-module/build \ - && tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \ + && tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \ && mv -f opentelemetry-webserver-sdk /opt/ \ && cd ../ \ && cp opentelemetry_module.conf /etc/httpd/conf/ \ @@ -278,7 +284,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \ && cd / # Remove unwanted files -RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \ +RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \ && rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \ && rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \ && rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz diff --git a/instrumentation/otel-webserver-module/build.gradle b/instrumentation/otel-webserver-module/build.gradle index 5f8ea4a41..61c232a34 100644 --- a/instrumentation/otel-webserver-module/build.gradle +++ b/instrumentation/otel-webserver-module/build.gradle @@ -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 { @@ -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, @@ -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 @@ -602,6 +602,9 @@ model { release } platforms { + arm { + architecture "arm64" + } x86 { architecture "x86" } diff --git a/instrumentation/otel-webserver-module/common.gradle b/instrumentation/otel-webserver-module/common.gradle index cc5707768..da9323c61 100644 --- a/instrumentation/otel-webserver-module/common.gradle +++ b/instrumentation/otel-webserver-module/common.gradle @@ -8,6 +8,9 @@ defaultTasks 'build' ext { ARCH = '' switch (System.properties['os.arch'].toLowerCase()) { + case "aarch64": + ARCH = "arm64" + break case "amd64": case "x86_64": ARCH = "x64" @@ -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') diff --git a/instrumentation/otel-webserver-module/docker-compose.yml b/instrumentation/otel-webserver-module/docker-compose.yml index 6c35ac6ac..c95d26e5f 100644 --- a/instrumentation/otel-webserver-module/docker-compose.yml +++ b/instrumentation/otel-webserver-module/docker-compose.yml @@ -7,6 +7,9 @@ services: build: context: . dockerfile: Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: apache_centos profiles: - default @@ -19,6 +22,9 @@ services: build: context: . dockerfile: docker/centos7/Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: apache_centos7 hostname: webserver container_name: webserver_centos7 @@ -33,6 +39,9 @@ services: build: context: . dockerfile: docker/ubuntu20.04/Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: apache_ubuntu hostname: webserver container_name: webserver_ubuntu @@ -47,6 +56,9 @@ services: build: context: . dockerfile: Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: nginx_centos hostname: webserver container_name: nginx_centos @@ -61,6 +73,9 @@ services: build: context: . dockerfile: docker/centos7/Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: nginx_centos7 hostname: webserver container_name: nginx_centos7 @@ -75,6 +90,9 @@ services: build: context: . dockerfile: docker/ubuntu20.04/Dockerfile + platforms: + - "linux/amd64" + - "linux/arm64" image: nginx_ubuntu hostname: webserver container_name: nginx_ubuntu diff --git a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile index 60ec1bf5c..fb8f24b0b 100644 --- a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile @@ -1,13 +1,17 @@ FROM centos:7 ARG BUILD_NUMBER +ARG BUILD_ARCH='x64' -LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER +LABEL NAME=apm/build-image-webserver-agent-centos6-${BUILD_ARCH} VERSION=$BUILD_NUMBER -ENV GOSU_ARCH amd64 -ENV JDK_ARCH x64 +ARG GOSU_ARCH='amd64' +ENV GOSU_ARCH=${GOSU_ARCH} +ARG JDK_ARCH='x64' +ENV JDK_ARCH=${JDK_ARCH} -ARG PYTHON_VERSION="2.7.8" +ARG PYTHON_VERSION="2.7.18" +ARG CMAKE_ARCH='x86_64' ARG CMAKE_VERSION="3.20" ARG CMAKE_0VERSION="3.20.0" ARG GRPC_VERSION="1.36.4" @@ -18,6 +22,7 @@ ARG APR_VERSION="1.7.0" ARG EXPAT_VERSION="2.3.0" ARG EXPAT_RVERSION="R_2_3_0" ARG APRUTIL_VERSION="1.6.1" +ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu' ARG AUTOCONF_VERSION="2.68" ARG LIBTOOL_VERSION="2.4.6" ARG LOG4CXX_VERSION="0.11.0" @@ -26,6 +31,7 @@ ARG AUTOMAKE_VERSION="1.16.3" ARG PERL_VERSION="5.20.2" ARG PERL_CPANVERSION="5.0" ARG PCRE_VERSION="8.44" +ARG NGINX_ARCH='x86_64' ARG NGINX_VERSION="1.26.0" # create default non-root user @@ -65,7 +71,7 @@ RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && yum clean all ENV PATH="/opt/rh/devtoolset-7/root/usr/bin:${PATH}" -# install python 2.7.8 +# install python RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz \ && unxz Python-${PYTHON_VERSION}.tar.xz \ && tar -xf Python-${PYTHON_VERSION}.tar \ @@ -74,14 +80,14 @@ RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERS && rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar # install gosu for easy step-down from root (from https://github.com/tianon/gosu/blob/master/INSTALL.md#from-centos) -ENV GOSU_VERSION=1.10 +ENV GOSU_VERSION=1.11 #RUN gpg --keyserver pgp.mit.edu --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ -# && curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \ -# && curl -o /usr/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \ +# && curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \ +# && curl -o /usr/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}.asc" \ # && gpg --verify /usr/bin/gosu.asc \ # && rm /usr/bin/gosu.asc \ # && rm -r /root/.gnupg/ \ -RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \ +RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \ && chmod +x /usr/bin/gosu \ # Verify that the binary works && gosu nobody true @@ -91,11 +97,11 @@ RUN yum install git -y \ && yum clean all # install cmake 3.20 -RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \ - && tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \ - && cd cmake-${CMAKE_0VERSION}-linux-x86_64 \ +RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \ + && tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \ + && cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \ && cp -rf * /usr/local/ \ - && cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz + && cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz # install grpc. If planning to upgrade, make sure sed command works RUN git clone https://github.com/grpc/grpc \ @@ -170,7 +176,7 @@ ENV PATH=$HOME/localperl/bin:$PATH RUN wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz \ && tar xzf autoconf-${AUTOCONF_VERSION}.tar.gz \ && cd autoconf-${AUTOCONF_VERSION} \ - && ./configure --prefix=/usr/ && make -j && make install && autoconf -V \ + && ./configure --prefix=/usr/ --build=${AUTOCONF_BUILD_TYPE} && make -j && make install && autoconf -V \ && cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz # install automake @@ -273,13 +279,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \ RUN echo '[nginx]' >> /etc/yum.repos.d/nginx.repo \ && echo 'name=nginx repo' >> /etc/yum.repos.d/nginx.repo \ - && echo 'baseurl=https://nginx.org/packages/centos/7/x86_64' >> /etc/yum.repos.d/nginx.repo \ + && echo "baseurl=https://nginx.org/packages/centos/7/${NGINX_ARCH}" >> /etc/yum.repos.d/nginx.repo \ && echo 'gpgcheck=0' >> /etc/yum.repos.d/nginx.repo \ && echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \ && yum install nginx-${NGINX_VERSION} -y RUN cd /otel-webserver-module/build \ - && tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \ + && tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \ && mv -f opentelemetry-webserver-sdk /opt/ \ && cd ../ \ && cp opentelemetry_module.conf /etc/httpd/conf/ \ @@ -295,7 +301,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \ && cd / # Remove unwanted files -RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \ +RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \ && rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \ && rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \ && rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz diff --git a/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile b/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile index 0df295570..7f948a505 100644 --- a/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile @@ -201,7 +201,7 @@ RUN cp -r /dependencies /otel-webserver-module/ \ && ./gradlew assembleWebServerModule -DtargetSystem=ubuntu RUN cd /otel-webserver-module/build \ - && tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \ + && tar -xf opentelemetry-webserver-sdk-*-linux.tgz \ && mv -f opentelemetry-webserver-sdk /opt/ \ && cd ../ \ && cp opentelemetry_module.conf /etc/apache2/opentelemetry_module.conf \ diff --git a/instrumentation/otel-webserver-module/test/ApacheTesting.sh b/instrumentation/otel-webserver-module/test/ApacheTesting.sh index 171c2ee1f..ebf69d8bd 100755 --- a/instrumentation/otel-webserver-module/test/ApacheTesting.sh +++ b/instrumentation/otel-webserver-module/test/ApacheTesting.sh @@ -5,6 +5,7 @@ # Extract the agent targetSystem=$1 +platform=$2 OTelApacheModule="/opt/opentelemetry-webserver-sdk/WebServerModule/Apache/libmod_apache_otel22.so" if [ $targetSystem = "ubuntu" ] || [ $targetSystem = "centos7" ]; then @@ -12,7 +13,7 @@ if [ $targetSystem = "ubuntu" ] || [ $targetSystem = "centos7" ]; then fi -tar -xf ../build/opentelemetry-webserver-sdk-x64-linux.tgz -C /opt +tar -xf ../build/opentelemetry-webserver-sdk-$platform-linux.tgz -C /opt cd /opt/opentelemetry-webserver-sdk diff --git a/instrumentation/otel-webserver-module/test/NginxTesting.sh b/instrumentation/otel-webserver-module/test/NginxTesting.sh index 5bc8cf437..2e567987f 100755 --- a/instrumentation/otel-webserver-module/test/NginxTesting.sh +++ b/instrumentation/otel-webserver-module/test/NginxTesting.sh @@ -3,7 +3,9 @@ # Bash script for testing Apache Server # Extract the agent -tar -xf ../build/opentelemetry-webserver-sdk-x64-linux.tgz -C /opt +platform=$1 + +tar -xf ../build/opentelemetry-webserver-sdk-$platform-linux.tgz -C /opt cd /opt/opentelemetry-sdk-native diff --git a/instrumentation/otel-webserver-module/test/unit/ApiUtils_test.cpp b/instrumentation/otel-webserver-module/test/unit/ApiUtils_test.cpp index b420dda32..3836f55c7 100644 --- a/instrumentation/otel-webserver-module/test/unit/ApiUtils_test.cpp +++ b/instrumentation/otel-webserver-module/test/unit/ApiUtils_test.cpp @@ -421,5 +421,5 @@ TEST(ApiUtils, getSDKInstallPath) { otel::core::ApiUtils apiUtils; auto path = apiUtils.getSDKInstallPath(); - EXPECT_THAT(path.string(), testing::EndsWith("build/linux-x64/opentelemetry-webserver-sdk")); + EXPECT_THAT(path.string(), testing::MatchesRegex(".*build/linux-(x|arm)64/opentelemetry-webserver-sdk")); }