From f40668a641298d7b5a282e7e8f8f07730199d363 Mon Sep 17 00:00:00 2001 From: Ricardo Katz Date: Fri, 26 Jan 2024 15:29:31 -0300 Subject: [PATCH] Move image build to CI --- .github/workflows/ci.yaml | 30 ++++++++++++++----- .github/workflows/nginx125.yaml | 2 +- .github/workflows/zz-tmpl-k8s-e2e.yaml | 3 +- images/nginx-1.25/Makefile | 2 +- .../ingress/controller/template/template.go | 3 +- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eb8815fb8..843294f27 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,6 +9,7 @@ on: - 'deploy/**' - '**.md' - 'images/**' # Images changes should be tested on their own workflow + - '!images/nginx-1.25/**' push: branches: @@ -41,6 +42,7 @@ jobs: outputs: go: ${{ steps.filter.outputs.go }} charts: ${{ steps.filter.outputs.charts }} + baseimage: ${{ steps.filter.outputs.baseimage }} steps: @@ -64,6 +66,8 @@ jobs: - 'charts/ingress-nginx/Chart.yaml' - 'charts/ingress-nginx/**/*' - 'NGINX_BASE' + baseimage: + - 'images/nginx-1.25/**' test-go: runs-on: ubuntu-latest @@ -89,8 +93,10 @@ jobs: runs-on: ubuntu-latest needs: changes if: | - (needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') - + (needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true') + + env: + PLATFORMS: linux/amd64 steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -119,7 +125,14 @@ jobs: curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl - + + - name: Build NGINX Base image + if: | + needs.changes.outputs.baseimage == 'true' + run: | + export TAG=$(cat images/nginx-1.25/TAG) + cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --load -t gcr.io/k8s-staging-ingress-nginx/nginx-1.25:${TAG} . + - name: Build images env: TAG: 1.0.0-dev @@ -127,7 +140,8 @@ jobs: REGISTRY: ingress-controller run: | echo "building images..." - make clean-image build image image-chroot + export TAGNGINX=$(cat images/nginx-1.25/TAG) + make BASE_IMAGE=gcr.io/k8s-staging-ingress-nginx/nginx-1.25:${TAGNGINX} clean-image build image image-chroot make -C test/e2e-image image echo "creating images cache..." @@ -154,7 +168,7 @@ jobs: strategy: matrix: - k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0] + k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0] steps: - name: Checkout @@ -235,7 +249,7 @@ jobs: (needs.changes.outputs.go == 'true') strategy: matrix: - k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0] + k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0] uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml with: k8s-version: ${{ matrix.k8s }} @@ -249,7 +263,7 @@ jobs: (needs.changes.outputs.go == 'true') strategy: matrix: - k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0] + k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0] uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml with: k8s-version: ${{ matrix.k8s }} @@ -264,7 +278,7 @@ jobs: (needs.changes.outputs.go == 'true') strategy: matrix: - k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0] + k8s: [v1.26.6, v1.27.3, v1.28.0, v1.29.0] uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml with: k8s-version: ${{ matrix.k8s }} diff --git a/.github/workflows/nginx125.yaml b/.github/workflows/nginx125.yaml index 4dfed9567..3a5b3372d 100644 --- a/.github/workflows/nginx125.yaml +++ b/.github/workflows/nginx125.yaml @@ -3,7 +3,7 @@ name: NGINX v1.25 Image on: pull_request: branches: - - "*" + - "kdsajdoiasjdoasijads" paths: - 'images/nginx-1.25/**' push: diff --git a/.github/workflows/zz-tmpl-k8s-e2e.yaml b/.github/workflows/zz-tmpl-k8s-e2e.yaml index d2941eb15..7709e9637 100644 --- a/.github/workflows/zz-tmpl-k8s-e2e.yaml +++ b/.github/workflows/zz-tmpl-k8s-e2e.yaml @@ -41,7 +41,8 @@ jobs: env: KIND_CLUSTER_NAME: kind SKIP_CLUSTER_CREATION: true - SKIP_IMAGE_CREATION: true + SKIP_INGRESS_IMAGE_CREATION: true + SKIP_E2E_IMAGE_CREATION: true ENABLE_VALIDATIONS: ${{ inputs.variation == 'VALIDATIONS' }} IS_CHROOT: ${{ inputs.variation == 'CHROOT' }} run: | diff --git a/images/nginx-1.25/Makefile b/images/nginx-1.25/Makefile index 96cb773e1..cdd3e2a3c 100644 --- a/images/nginx-1.25/Makefile +++ b/images/nginx-1.25/Makefile @@ -22,7 +22,7 @@ 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) +TAG ?=$(shell cat TAG) REGISTRY ?= gcr.io/k8s-staging-ingress-nginx diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index 68ab1b660..f08eee498 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -1501,8 +1501,7 @@ func httpsListener(addresses []string, co string, tc *config.TemplateConfig) []s } } - lo = append(lo, co, "ssl") - lo = append(lo, ";") + lo = append(lo, co, "ssl;") out = append(out, strings.Join(lo, " ")) }