Add OTEL build test
This commit is contained in:
parent
e8699bfb92
commit
dbfea38a17
5 changed files with 97 additions and 4 deletions
20
.github/workflows/images.yaml
vendored
20
.github/workflows/images.yaml
vendored
|
@ -36,6 +36,7 @@ jobs:
|
||||||
kube-webhook-certgen: ${{ steps.filter.outputs.kube-webhook-certgen }}
|
kube-webhook-certgen: ${{ steps.filter.outputs.kube-webhook-certgen }}
|
||||||
ext-auth-example-authsvc: ${{ steps.filter.outputs.ext-auth-example-authsvc }}
|
ext-auth-example-authsvc: ${{ steps.filter.outputs.ext-auth-example-authsvc }}
|
||||||
nginx: ${{ steps.filter.outputs.nginx }}
|
nginx: ${{ steps.filter.outputs.nginx }}
|
||||||
|
opentelemetry: ${{ steps.filter.outputs.opentelemetry }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -63,6 +64,8 @@ jobs:
|
||||||
- 'images/ext-auth-example-authsvc/**'
|
- 'images/ext-auth-example-authsvc/**'
|
||||||
nginx:
|
nginx:
|
||||||
- 'images/nginx/**'
|
- 'images/nginx/**'
|
||||||
|
opentelemetry:
|
||||||
|
- 'images/opentelemetry/**'
|
||||||
|
|
||||||
#### TODO: Make the below jobs 'less dumb' and use the job name as parameter (the github.job context does not work here)
|
#### TODO: Make the below jobs 'less dumb' and use the job name as parameter (the github.job context does not work here)
|
||||||
cfssl:
|
cfssl:
|
||||||
|
@ -179,3 +182,20 @@ jobs:
|
||||||
uses: github/codeql-action/upload-sarif@v3.23.1
|
uses: github/codeql-action/upload-sarif@v3.23.1
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
|
|
||||||
|
opentelemetry:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PLATFORMS: linux/amd64,linux/arm,linux/arm64,linux/s390x
|
||||||
|
needs: changes
|
||||||
|
if: |
|
||||||
|
(needs.changes.outputs.opentelemetry == 'true')
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
nginx: ['1.25.3', '1.21.6']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
- name: image build
|
||||||
|
run: |
|
||||||
|
cd images/opentelemetry && make NGINX_VERSION=${{ matrix.nginx }} build
|
||||||
|
|
69
images/opentelemetry/Makefile
Normal file
69
images/opentelemetry/Makefile
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# Copyright 2024 The Kubernetes Authors. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
.DEFAULT_GOAL:=build
|
||||||
|
|
||||||
|
# set default shell
|
||||||
|
SHELL=/bin/bash -o pipefail -o errexit
|
||||||
|
|
||||||
|
DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||||
|
INIT_BUILDX=$(DIR)/../../hack/init-buildx.sh
|
||||||
|
|
||||||
|
# 0.0.0 shouldn't clobber any released builds
|
||||||
|
SHORT_SHA ?=$(shell git rev-parse --short HEAD)
|
||||||
|
TAG ?=v$(shell date +%Y%m%d)-$(SHORT_SHA)
|
||||||
|
|
||||||
|
REGISTRY ?= gcr.io/k8s-staging-ingress-nginx
|
||||||
|
|
||||||
|
IMAGE = $(REGISTRY)/opentelemetry
|
||||||
|
|
||||||
|
# required to enable buildx
|
||||||
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
|
||||||
|
# build with buildx
|
||||||
|
PLATFORMS?=linux/amd64,linux/arm,linux/arm64,linux/s390x
|
||||||
|
OUTPUT=
|
||||||
|
PROGRESS=plain
|
||||||
|
|
||||||
|
precheck:
|
||||||
|
ifndef NGINX_VERSION
|
||||||
|
$(error NGINX_VERSION variable is required)
|
||||||
|
endif
|
||||||
|
|
||||||
|
build: precheck ensure-buildx
|
||||||
|
docker buildx build \
|
||||||
|
--label=org.opencontainers.image.source=https://github.com/kubernetes/ingress-nginx \
|
||||||
|
--label=org.opencontainers.image.licenses=Apache-2.0 \
|
||||||
|
--label=org.opencontainers.image.description="Ingress NGINX Opentelemetry image" \
|
||||||
|
--platform=${PLATFORMS} $(OUTPUT) \
|
||||||
|
--progress=$(PROGRESS) \
|
||||||
|
--build-arg=$(NGINX_VERSION) \
|
||||||
|
--pull \
|
||||||
|
--tag $(IMAGE)-$(NGINX_VERSION):$(TAG) rootfs
|
||||||
|
|
||||||
|
# push the cross built image
|
||||||
|
push: OUTPUT=--push
|
||||||
|
push: build
|
||||||
|
|
||||||
|
# enable buildx
|
||||||
|
ensure-buildx:
|
||||||
|
# this is required for cloudbuild
|
||||||
|
ifeq ("$(wildcard $(INIT_BUILDX))","")
|
||||||
|
@curl -sSL https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/hack/init-buildx.sh | bash
|
||||||
|
else
|
||||||
|
@exec $(INIT_BUILDX)
|
||||||
|
endif
|
||||||
|
@echo "done"
|
||||||
|
|
||||||
|
.PHONY: build precheck push ensure-buildx
|
|
@ -16,4 +16,5 @@ steps:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
gcloud auth configure-docker \
|
gcloud auth configure-docker \
|
||||||
&& cd images/ && make NAME=opentelemetry push
|
&& cd images/opentelemetry && make NGINX_VERSION=1.25.3 push \
|
||||||
|
&& make NGINX_VERSION=1.21.6 push
|
||||||
|
|
|
@ -38,11 +38,12 @@ RUN bash /opt/third_party/build.sh -o v1.11.0
|
||||||
|
|
||||||
# install otel_ngx_module.so
|
# install otel_ngx_module.so
|
||||||
FROM base as nginx
|
FROM base as nginx
|
||||||
|
ARG NGINX_VERSION=1.25.3
|
||||||
COPY --from=grpc /opt/third_party/install/ /usr
|
COPY --from=grpc /opt/third_party/install/ /usr
|
||||||
COPY --from=otel-cpp /opt/third_party/install/ /usr
|
COPY --from=otel-cpp /opt/third_party/install/ /usr
|
||||||
RUN bash /opt/third_party/build.sh -n
|
RUN bash /opt/third_party/build.sh -n ${NGINX_VERSION}
|
||||||
|
|
||||||
FROM cgr.dev/chainguard/go:latest as build-init
|
FROM golang:1.21.6-bullseye as build-init
|
||||||
|
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
|
@ -23,6 +23,8 @@ export GRPC_GIT_TAG=${GRPC_GIT_TAG:="v1.43.2"}
|
||||||
export OPENTELEMETRY_CPP_VERSION=${OPENTELEMETRY_CPP_VERSION:="1.2.0"}
|
export OPENTELEMETRY_CPP_VERSION=${OPENTELEMETRY_CPP_VERSION:="1.2.0"}
|
||||||
export ABSL_CPP_VERSION=${ABSL_CPP_VERSION:="20230802.0"}
|
export ABSL_CPP_VERSION=${ABSL_CPP_VERSION:="20230802.0"}
|
||||||
export INSTAL_DIR=/opt/third_party/install
|
export INSTAL_DIR=/opt/third_party/install
|
||||||
|
|
||||||
|
export NGINX_VERSION=${NGINX_VERSION:-"1.25.3"}
|
||||||
# improve compilation times
|
# improve compilation times
|
||||||
CORES=$(($(grep -c ^processor /proc/cpuinfo) - 1))
|
CORES=$(($(grep -c ^processor /proc/cpuinfo) - 1))
|
||||||
|
|
||||||
|
@ -148,7 +150,6 @@ get_src()
|
||||||
|
|
||||||
install_nginx()
|
install_nginx()
|
||||||
{
|
{
|
||||||
export NGINX_VERSION=1.25.3
|
|
||||||
|
|
||||||
# Check for recent changes: https://github.com/open-telemetry/opentelemetry-cpp-contrib/compare/2656a4...main
|
# Check for recent changes: https://github.com/open-telemetry/opentelemetry-cpp-contrib/compare/2656a4...main
|
||||||
export OPENTELEMETRY_CONTRIB_COMMIT=aaa51e2297bcb34297f3c7aa44fa790497d2f7f3
|
export OPENTELEMETRY_CONTRIB_COMMIT=aaa51e2297bcb34297f3c7aa44fa790497d2f7f3
|
||||||
|
@ -197,6 +198,7 @@ while getopts ":pha:g:o:n" option; do
|
||||||
prepare
|
prepare
|
||||||
exit;;
|
exit;;
|
||||||
n) # install nginx
|
n) # install nginx
|
||||||
|
NGINX_VERSION=${OPTARG}
|
||||||
install_nginx
|
install_nginx
|
||||||
exit;;
|
exit;;
|
||||||
a) # install abseil
|
a) # install abseil
|
||||||
|
|
Loading…
Reference in a new issue