Skip to content

Commit 02e6ebc

Browse files
authored
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
1 parent c295cd1 commit 02e6ebc

File tree

20 files changed

+247
-409
lines changed

20 files changed

+247
-409
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- 'deploy/**'
1010
- '**.md'
1111
- 'images/**' # Images changes should be tested on their own workflow
12+
- '!images/nginx-1.25/**'
1213

1314
push:
1415
branches:
@@ -41,6 +42,7 @@ jobs:
4142
outputs:
4243
go: ${{ steps.filter.outputs.go }}
4344
charts: ${{ steps.filter.outputs.charts }}
45+
baseimage: ${{ steps.filter.outputs.baseimage }}
4446

4547
steps:
4648

@@ -64,6 +66,8 @@ jobs:
6466
- 'charts/ingress-nginx/Chart.yaml'
6567
- 'charts/ingress-nginx/**/*'
6668
- 'NGINX_BASE'
69+
baseimage:
70+
- 'images/nginx-1.25/**'
6771
6872
test-go:
6973
runs-on: ubuntu-latest
@@ -89,8 +93,10 @@ jobs:
8993
runs-on: ubuntu-latest
9094
needs: changes
9195
if: |
92-
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true')
93-
96+
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true')
97+
98+
env:
99+
PLATFORMS: linux/amd64
94100
steps:
95101
- name: Checkout
96102
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -119,15 +125,23 @@ jobs:
119125
curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl
120126
chmod +x ./kubectl
121127
sudo mv ./kubectl /usr/local/bin/kubectl
122-
128+
129+
- name: Build NGINX Base image
130+
if: |
131+
needs.changes.outputs.baseimage == 'true'
132+
run: |
133+
export TAG=$(cat images/nginx-1.25/TAG)
134+
cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --load -t gcr.io/k8s-staging-ingress-nginx/nginx-1.25:${TAG} .
135+
123136
- name: Build images
124137
env:
125138
TAG: 1.0.0-dev
126139
ARCH: amd64
127140
REGISTRY: ingress-controller
128141
run: |
129142
echo "building images..."
130-
make clean-image build image image-chroot
143+
export TAGNGINX=$(cat images/nginx-1.25/TAG)
144+
make BASE_IMAGE=gcr.io/k8s-staging-ingress-nginx/nginx-1.25:${TAGNGINX} clean-image build image image-chroot
131145
make -C test/e2e-image image
132146
133147
echo "creating images cache..."
@@ -150,11 +164,11 @@ jobs:
150164
- changes
151165
- build
152166
if: |
153-
(needs.changes.outputs.charts == 'true')
167+
(needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true')
154168
155169
strategy:
156170
matrix:
157-
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
171+
k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0]
158172

159173
steps:
160174
- name: Checkout
@@ -222,6 +236,7 @@ jobs:
222236
KIND_CLUSTER_NAME: kind
223237
SKIP_CLUSTER_CREATION: true
224238
SKIP_IMAGE_CREATION: true
239+
SKIP_INGRESS_IMAGE_CREATION: true
225240
run: |
226241
kind get kubeconfig > $HOME/.kube/kind-config-kind
227242
make kind-e2e-chart-tests
@@ -232,10 +247,10 @@ jobs:
232247
- changes
233248
- build
234249
if: |
235-
(needs.changes.outputs.go == 'true')
250+
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.baseimage == 'true')
236251
strategy:
237252
matrix:
238-
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
253+
k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0]
239254
uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
240255
with:
241256
k8s-version: ${{ matrix.k8s }}
@@ -246,10 +261,10 @@ jobs:
246261
- changes
247262
- build
248263
if: |
249-
(needs.changes.outputs.go == 'true')
264+
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.baseimage == 'true')
250265
strategy:
251266
matrix:
252-
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
267+
k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0]
253268
uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
254269
with:
255270
k8s-version: ${{ matrix.k8s }}
@@ -261,10 +276,10 @@ jobs:
261276
- changes
262277
- build
263278
if: |
264-
(needs.changes.outputs.go == 'true')
279+
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.baseimage == 'true')
265280
strategy:
266281
matrix:
267-
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
282+
k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0]
268283
uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
269284
with:
270285
k8s-version: ${{ matrix.k8s }}

.github/workflows/images.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
kube-webhook-certgen: ${{ steps.filter.outputs.kube-webhook-certgen }}
3737
ext-auth-example-authsvc: ${{ steps.filter.outputs.ext-auth-example-authsvc }}
3838
nginx: ${{ steps.filter.outputs.nginx }}
39+
nginx125: ${{ steps.filter.outputs.nginx125 }}
40+
opentelemetry: ${{ steps.filter.outputs.opentelemetry }}
3941

4042
steps:
4143
- name: Checkout
@@ -63,6 +65,10 @@ jobs:
6365
- 'images/ext-auth-example-authsvc/**'
6466
nginx:
6567
- 'images/nginx/**'
68+
opentelemetry:
69+
- 'images/opentelemetry/**'
70+
nginx125:
71+
- 'images/nginx-1.25/TAG'
6672
6773
#### TODO: Make the below jobs 'less dumb' and use the job name as parameter (the github.job context does not work here)
6874
cfssl:
@@ -179,3 +185,53 @@ jobs:
179185
uses: github/codeql-action/upload-sarif@v3.23.1
180186
with:
181187
sarif_file: 'trivy-results.sarif'
188+
189+
opentelemetry:
190+
runs-on: ubuntu-latest
191+
env:
192+
PLATFORMS: linux/amd64,linux/arm,linux/arm64
193+
needs: changes
194+
if: |
195+
(needs.changes.outputs.opentelemetry == 'true')
196+
strategy:
197+
matrix:
198+
nginx: ['1.25.3', '1.21.6']
199+
steps:
200+
- name: Checkout
201+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
202+
- name: image build
203+
run: |
204+
cd images/opentelemetry && make NGINX_VERSION=${{ matrix.nginx }} build
205+
206+
nginx125:
207+
permissions:
208+
contents: write
209+
packages: write
210+
runs-on: ubuntu-latest
211+
needs: changes
212+
if: |
213+
(github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changes.outputs.nginx125 == 'true')
214+
env:
215+
PLATFORMS: linux/amd64,linux/arm,linux/arm64
216+
steps:
217+
- name: Checkout
218+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
219+
- name: Set up QEMU
220+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
221+
- name: Set up Docker Buildx
222+
id: buildx
223+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
224+
with:
225+
version: latest
226+
platforms: ${{ env.PLATFORMS }}
227+
- name: Login to GitHub Container Registry
228+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
229+
with:
230+
username: ${{ secrets.DOCKERHUB_USERNAME }}
231+
password: ${{ secrets.DOCKERHUB_TOKEN }}
232+
- name: build-image
233+
run: |
234+
export TAG=$(cat images/nginx-1.25/TAG)
235+
cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --push --load -t ingressnginx/nginx-1.25:${TAG} .
236+
237+

.github/workflows/nginx125.yaml

Lines changed: 0 additions & 167 deletions
This file was deleted.

.github/workflows/zz-tmpl-k8s-e2e.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
env:
4242
KIND_CLUSTER_NAME: kind
4343
SKIP_CLUSTER_CREATION: true
44-
SKIP_IMAGE_CREATION: true
44+
SKIP_INGRESS_IMAGE_CREATION: true
45+
SKIP_E2E_IMAGE_CREATION: true
4546
ENABLE_VALIDATIONS: ${{ inputs.variation == 'VALIDATIONS' }}
4647
IS_CHROOT: ${{ inputs.variation == 'CHROOT' }}
4748
run: |

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ ensure-buildx:
231231
show-version:
232232
echo -n $(TAG)
233233

234-
PLATFORMS ?= amd64 arm arm64 s390x
235-
BUILDX_PLATFORMS ?= linux/amd64,linux/arm,linux/arm64,linux/s390x
234+
PLATFORMS ?= amd64 arm arm64
235+
BUILDX_PLATFORMS ?= linux/amd64,linux/arm,linux/arm64
236236

237237
.PHONY: release # Build a multi-arch docker image
238238
release: ensure-buildx clean

0 commit comments

Comments
 (0)