4
4
push :
5
5
branches :
6
6
- master
7
+ - release-*
7
8
paths-ignore :
8
9
- ' docs/**'
9
10
- ' examples/**'
13
14
pull_request :
14
15
branches :
15
16
- master
16
- - ' release-*'
17
+ - release-*
17
18
paths-ignore :
18
19
- ' docs/**'
19
20
- ' examples/**'
@@ -30,7 +31,7 @@ defaults:
30
31
shell : bash
31
32
32
33
env :
33
- K8S_VERSION : 1.23.0
34
+ K8S_VERSION : 1.23.1
34
35
K8S_TIMEOUT : 75s
35
36
HELM_CHART_DIR : deployments/helm-chart
36
37
GIT_NAME : NGINX Kubernetes Team
@@ -165,7 +166,7 @@ jobs:
165
166
{\"image\": \"opentracing-plus\", \"marker\": \"vsr\"}, \
166
167
{\"image\": \"ubi-plus\", \"marker\": \"policies\"}]}"
167
168
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 \"]}"
169
170
fi
170
171
171
172
smoke-tests :
@@ -291,13 +292,14 @@ jobs:
291
292
name : Build Docker Images
292
293
runs-on : ubuntu-20.04
293
294
needs : build-binaries
295
+ if : ${{ !startsWith(github.ref, 'refs/heads/release') }}
294
296
strategy :
295
297
matrix :
296
298
image : [debian, alpine, opentracing, alpine-opentracing]
297
299
platforms : ["linux/arm, linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"]
298
300
include :
299
301
- image : ubi
300
- platforms : " linux/arm64, linux/amd64"
302
+ platforms : " linux/arm64, linux/amd64, linux/s390x "
301
303
steps :
302
304
- name : Checkout Repository
303
305
uses : actions/checkout@v2
@@ -343,7 +345,7 @@ jobs:
343
345
nginx/nginx-ingress
344
346
ghcr.io/nginxinc/kubernetes-ingress
345
347
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
347
349
tags : |
348
350
type=edge
349
351
type=ref,event=pr
@@ -357,7 +359,7 @@ jobs:
357
359
- name : Output Variables
358
360
id : var
359
361
run : |
360
- version=${{ fromJSON( steps.meta.outputs.json).labels['org.opencontainers.image. version'] }}
362
+ version=${{ steps.meta.outputs.version }}
361
363
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
362
364
ic_version=v$version
363
365
else
@@ -366,7 +368,7 @@ jobs:
366
368
ic_version=$tag-$version-$sha_short
367
369
fi
368
370
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)
370
372
uses : docker/build-push-action@v2
371
373
with :
372
374
file : build/Dockerfile
@@ -384,10 +386,135 @@ jobs:
384
386
BUILD_OS=${{ matrix.image }}
385
387
IC_VERSION=${{ steps.var.outputs.ic_version }}
386
388
- name : Run Trivy vulnerability scanner
387
- uses :
aquasecurity/[email protected] .0
389
+ uses :
aquasecurity/[email protected] .2
388
390
continue-on-error : true
389
391
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 }}
391
518
format : ' template'
392
519
template : ' @/contrib/sarif.tpl'
393
520
output : ' trivy-results-${{ matrix.image }}.sarif'
@@ -412,7 +539,7 @@ jobs:
412
539
outputs :
413
540
version : ${{ steps.var.outputs.helm_version }}
414
541
type : ${{ steps.var.outputs.helm_type }}
415
- if : github.event_name == 'push'
542
+ if : ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/release') }}
416
543
steps :
417
544
- name : Checkout Repository
418
545
uses : actions/checkout@v2
@@ -442,7 +569,7 @@ jobs:
442
569
name : Release Helm Chart
443
570
runs-on : ubuntu-20.04
444
571
needs : package-helm
445
- if : github.event_name == 'push'
572
+ if : ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/release') }}
446
573
steps :
447
574
- name : Checkout Repository
448
575
uses : actions/checkout@v2
0 commit comments