Skip to content

Commit b77cdc1

Browse files
authored
Update CI to build for Plus (#2435)
1 parent 97c02d4 commit b77cdc1

File tree

2 files changed

+139
-12
lines changed

2 files changed

+139
-12
lines changed

.github/workflows/ci.yml

Lines changed: 138 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- release-*
78
paths-ignore:
89
- 'docs/**'
910
- 'examples/**'
@@ -13,7 +14,7 @@ on:
1314
pull_request:
1415
branches:
1516
- master
16-
- 'release-*'
17+
- release-*
1718
paths-ignore:
1819
- 'docs/**'
1920
- 'examples/**'
@@ -30,7 +31,7 @@ defaults:
3031
shell: bash
3132

3233
env:
33-
K8S_VERSION: 1.23.0
34+
K8S_VERSION: 1.23.1
3435
K8S_TIMEOUT: 75s
3536
HELM_CHART_DIR: deployments/helm-chart
3637
GIT_NAME: NGINX Kubernetes Team
@@ -165,7 +166,7 @@ jobs:
165166
{\"image\": \"opentracing-plus\", \"marker\": \"vsr\"}, \
166167
{\"image\": \"ubi-plus\", \"marker\": \"policies\"}]}"
167168
else
168-
echo "::set-output name=matrix::{\"k8s\": [\"1.19.11\", \"1.20.7\", \"1.21.2\", \"1.22.4\", \"1.23.0\"]}"
169+
echo "::set-output name=matrix::{\"k8s\": [\"1.19.11\", \"1.20.7\", \"1.21.2\", \"1.22.4\", \"1.23.1\"]}"
169170
fi
170171
171172
smoke-tests:
@@ -291,13 +292,14 @@ jobs:
291292
name: Build Docker Images
292293
runs-on: ubuntu-20.04
293294
needs: build-binaries
295+
if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
294296
strategy:
295297
matrix:
296298
image: [debian, alpine, opentracing, alpine-opentracing]
297299
platforms: ["linux/arm, linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"]
298300
include:
299301
- image: ubi
300-
platforms: "linux/arm64, linux/amd64"
302+
platforms: "linux/arm64, linux/amd64, linux/s390x"
301303
steps:
302304
- name: Checkout Repository
303305
uses: actions/checkout@v2
@@ -343,7 +345,7 @@ jobs:
343345
nginx/nginx-ingress
344346
ghcr.io/nginxinc/kubernetes-ingress
345347
public.ecr.aws/nginx/nginx-ingress
346-
flavor: suffix=${{ matrix.image == 'ubi' && '-ubi' || '' }}${{ contains(matrix.image, 'alpine') && '-alpine' || '' }}${{ contains(matrix.image, 'opentracing') && '-ot' || '' }},onlatest=true
348+
flavor: suffix=${{ contains(matrix.image, 'ubi') && '-ubi' || '' }}${{ contains(matrix.image, 'alpine') && '-alpine' || '' }}${{ contains(matrix.image, 'opentracing') && '-ot' || '' }},onlatest=true
347349
tags: |
348350
type=edge
349351
type=ref,event=pr
@@ -357,7 +359,7 @@ jobs:
357359
- name: Output Variables
358360
id: var
359361
run: |
360-
version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
362+
version=${{ steps.meta.outputs.version }}
361363
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
362364
ic_version=v$version
363365
else
@@ -366,7 +368,7 @@ jobs:
366368
ic_version=$tag-$version-$sha_short
367369
fi
368370
echo "::set-output name=ic_version::$ic_version"
369-
- name: Build Docker images (and push to Dockerhub if not a PR)
371+
- name: Build Docker image (and push if not a PR)
370372
uses: docker/build-push-action@v2
371373
with:
372374
file: build/Dockerfile
@@ -384,10 +386,135 @@ jobs:
384386
BUILD_OS=${{ matrix.image }}
385387
IC_VERSION=${{ steps.var.outputs.ic_version }}
386388
- name: Run Trivy vulnerability scanner
387-
uses: aquasecurity/[email protected].0
389+
uses: aquasecurity/[email protected].2
388390
continue-on-error: true
389391
with:
390-
image-ref: nginx/nginx-ingress:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
392+
image-ref: nginx/nginx-ingress:${{ steps.meta.outputs.version }}
393+
format: 'template'
394+
template: '@/contrib/sarif.tpl'
395+
output: 'trivy-results-${{ matrix.image }}.sarif'
396+
ignore-unfixed: 'true'
397+
- name: Upload Trivy scan results to GitHub Security tab
398+
uses: github/codeql-action/upload-sarif@v1
399+
continue-on-error: true
400+
with:
401+
sarif_file: 'trivy-results-${{ matrix.image }}.sarif'
402+
- name: Upload Scan Results
403+
uses: actions/upload-artifact@v2
404+
continue-on-error: true
405+
with:
406+
name: 'trivy-results-${{ matrix.image }}.sarif'
407+
path: 'trivy-results-${{ matrix.image }}.sarif'
408+
if: always()
409+
410+
build-docker-plus:
411+
name: Build Plus Docker Images
412+
runs-on: ubuntu-20.04
413+
needs: build-binaries
414+
strategy:
415+
matrix:
416+
image: [debian-plus, alpine-plus, opentracing-plus]
417+
platforms: ["linux/arm64, linux/amd64"]
418+
include:
419+
- image: ubi-plus
420+
platforms: "linux/arm64, linux/amd64, linux/s390x"
421+
steps:
422+
- name: Checkout Repository
423+
uses: actions/checkout@v2
424+
with:
425+
fetch-depth: 0
426+
- name: Fetch Cached Artifacts
427+
uses: actions/cache@v2
428+
with:
429+
path: ${{ github.workspace }}/dist
430+
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}-multi
431+
- name: Setup QEMU
432+
uses: docker/setup-qemu-action@v1
433+
with:
434+
platforms: arm64
435+
if: github.event_name != 'pull_request'
436+
- name: Docker Buildx
437+
uses: docker/setup-buildx-action@v1
438+
- name: GCR Login
439+
uses: docker/login-action@v1
440+
with:
441+
registry: gcr.io
442+
username: _json_key
443+
password: ${{ secrets.GCR_JSON_KEY }}
444+
if: github.event_name != 'pull_request'
445+
446+
- name: Docker meta
447+
id: meta
448+
uses: docker/metadata-action@v3
449+
with:
450+
images: |
451+
${{ startsWith(github.ref, 'refs/tags/') && 'gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/release/nginx-ic/nginx-plus-ingress' || '' }}
452+
${{ startsWith(github.ref, 'refs/heads/release') && 'gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/staging/nginx-ic/nginx-plus-ingress' || '' }}
453+
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic/nginx-plus-ingress
454+
flavor: suffix=${{ contains(matrix.image, 'ubi') && '-ubi' || '' }}${{ contains(matrix.image, 'alpine') && '-alpine' || '' }}${{ contains(matrix.image, 'opentracing') && '-ot' || '' }},onlatest=true
455+
tags: |
456+
type=edge
457+
type=ref,event=branch,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
458+
type=ref,event=pr
459+
type=schedule,pattern={{date 'YYYYMMDD'}}
460+
type=semver,pattern={{version}}
461+
labels: |
462+
org.opencontainers.image.description=NGINX Plus Ingress Controller for Kubernetes
463+
org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
464+
org.opencontainers.image.vendor=NGINX Inc <[email protected]>
465+
466+
- name: Output Variables
467+
id: var
468+
run: |
469+
version=${{ steps.meta.outputs.version }}
470+
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
471+
ic_version=v$version
472+
else
473+
tag=$(git describe --tags --abbrev=0)
474+
sha_short=$(echo ${{ github.sha }} | cut -c1-7)
475+
ic_version=$tag-$version-$sha_short
476+
fi
477+
echo "::set-output name=ic_version::$ic_version"
478+
- name: Build Plus Docker image
479+
uses: docker/build-push-action@v2
480+
with:
481+
file: build/Dockerfile
482+
context: '.'
483+
cache-from: type=gha,scope=${{ matrix.image }}
484+
cache-to: type=gha,scope=${{ matrix.image }},mode=max
485+
target: goreleaser
486+
tags: ${{ steps.meta.outputs.tags }}
487+
labels: ${{ steps.meta.outputs.labels }}
488+
platforms: ${{ github.event_name != 'pull_request' && matrix.platforms || '' }}
489+
load: ${{ github.event_name == 'pull_request' }}
490+
push: ${{ github.event_name != 'pull_request' }}
491+
pull: true
492+
build-args: |
493+
BUILD_OS=${{ matrix.image }}
494+
IC_VERSION=${{ startsWith(github.ref, 'refs/tags/') && steps.var.outputs.ic_version || 'CI' }}
495+
secrets: |
496+
"nginx-repo.crt=${{ secrets.NGINX_CRT }}"
497+
"nginx-repo.key=${{ secrets.NGINX_KEY }}"
498+
- name: Load image for Trivy
499+
uses: docker/build-push-action@v2
500+
with:
501+
file: build/Dockerfile
502+
context: '.'
503+
cache-from: type=gha,scope=${{ matrix.image }}
504+
target: goreleaser
505+
tags: docker.io/${{ matrix.image }}:${{ steps.meta.outputs.version }}
506+
load: true
507+
build-args: |
508+
BUILD_OS=${{ matrix.image }}
509+
IC_VERSION=CI
510+
secrets: |
511+
"nginx-repo.crt=${{ secrets.NGINX_CRT }}"
512+
"nginx-repo.key=${{ secrets.NGINX_KEY }}"
513+
- name: Run Trivy vulnerability scanner
514+
uses: aquasecurity/[email protected]
515+
continue-on-error: true
516+
with:
517+
image-ref: docker.io/${{ matrix.image }}:${{ steps.meta.outputs.version }}
391518
format: 'template'
392519
template: '@/contrib/sarif.tpl'
393520
output: 'trivy-results-${{ matrix.image }}.sarif'
@@ -412,7 +539,7 @@ jobs:
412539
outputs:
413540
version: ${{ steps.var.outputs.helm_version }}
414541
type: ${{ steps.var.outputs.helm_type }}
415-
if: github.event_name == 'push'
542+
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/release') }}
416543
steps:
417544
- name: Checkout Repository
418545
uses: actions/checkout@v2
@@ -442,7 +569,7 @@ jobs:
442569
name: Release Helm Chart
443570
runs-on: ubuntu-20.04
444571
needs: package-helm
445-
if: github.event_name == 'push'
572+
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/release') }}
446573
steps:
447574
- name: Checkout Repository
448575
uses: actions/checkout@v2

docs/content/technical-specifications.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ All images include NGINX 1.21.5.
3333
|Alpine-based image with OpenTracing | ``nginx:1.21.5-alpine``, which is based on ``alpine:3.15`` | NGINX OpenTracing module, OpenTracing library, OpenTracing tracers for Jaeger, Zipkin and Datadog | ``nginx/nginx-ingress:2.1.0-alpine-ot`` | arm/v7, arm64, amd64, ppc64le, s390x |
3434
|Debian-based image | ``nginx:1.21.5``, which is based on ``debian:bullseye-slim`` | | ``nginx/nginx-ingress:2.1.0`` | arm/v7, arm64, amd64, ppc64le, s390x |
3535
|Debian-based image with OpenTracing | ``nginx:1.21.5``, which is based on ``debian:bullseye-slim`` | NGINX OpenTracing module, OpenTracing library, OpenTracing tracers for Jaeger, Zipkin and Datadog | ``nginx/nginx-ingress:2.1.0-ot`` | arm/v7, arm64, amd64, ppc64le, s390x |
36-
|Ubi-based image | ``redhat/ubi8-minimal`` | | ``nginx/nginx-ingress:2.1.0-ubi`` | arm64, amd64 |
36+
|Ubi-based image | ``redhat/ubi8-minimal`` | | ``nginx/nginx-ingress:2.1.0-ubi`` | arm64, amd64, s390x |
3737
{{% /table %}}
3838

3939
### Images with NGINX Plus

0 commit comments

Comments
 (0)