Add OTEL build test and for NGINX v1.25 (#10889)

* Add OTEL build test

* Simplify otel compilation

* Remove http2 deprecated arg

* Move image build to CI

* Turn image from scratch to optimize usage

* rollback image from scratch

* Final reviews on nginx v1.25 image

* Remove s390x from final image
This commit is contained in:
Ricardo Katz 2024-01-27 12:33:50 -03:00 committed by GitHub
parent c295cd1c4b
commit 02e6ebc95a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 247 additions and 409 deletions

View file

@ -48,6 +48,9 @@ RUN apk update \
yaml-cpp \
dumb-init \
tzdata \
grpc-cpp \
libprotobuf \
&& apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing opentelemetry-cpp-exporter-otlp-common opentelemetry-cpp-exporter-otlp-grpc \
&& ln -s /usr/local/nginx/sbin/nginx /sbin/nginx \
&& adduser -S -D -H -u 101 -h /usr/local/nginx \
-s /sbin/nologin -G www-data -g www-data www-data \

View file

@ -129,6 +129,7 @@ get_src()
}
# install required packages to build
# Dependencies from "ninja" and below are OTEL dependencies
apk add \
bash \
gcc \
@ -165,7 +166,22 @@ apk add \
unzip \
dos2unix \
yaml-cpp \
coreutils
coreutils \
ninja \
gtest-dev \
git \
build-base \
pkgconfig \
c-ares-dev \
re2-dev \
grpc-dev \
protobuf-dev
apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing opentelemetry-cpp-dev
# There is some bug with some platforms and git, so force HTTP/1.1
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
mkdir -p /etc/nginx
@ -472,6 +488,33 @@ make
make modules
make install
export OPENTELEMETRY_CONTRIB_COMMIT=aaa51e2297bcb34297f3c7aa44fa790497d2f7f3
cd "$BUILD_PATH"
git clone https://github.com/open-telemetry/opentelemetry-cpp-contrib.git opentelemetry-cpp-contrib-${OPENTELEMETRY_CONTRIB_COMMIT}
cd ${BUILD_PATH}/opentelemetry-cpp-contrib-${OPENTELEMETRY_CONTRIB_COMMIT}
git reset --hard ${OPENTELEMETRY_CONTRIB_COMMIT}
export OTEL_TEMP_INSTALL=/tmp/otel
mkdir -p ${OTEL_TEMP_INSTALL}
cd ${BUILD_PATH}/opentelemetry-cpp-contrib-${OPENTELEMETRY_CONTRIB_COMMIT}/instrumentation/nginx
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_INSTALL_PREFIX=${OTEL_TEMP_INSTALL} \
-DBUILD_SHARED_LIBS=ON \
-DNGINX_VERSION=${NGINX_VERSION} \
..
cmake --build . -j ${CORES} --target install
mkdir -p /etc/nginx/modules
cp ${OTEL_TEMP_INSTALL}/otel_ngx_module.so /etc/nginx/modules/otel_ngx_module.so
cd "$BUILD_PATH/lua-resty-core"
make install