Move image build to CI

This commit is contained in:
Ricardo Katz 2024-01-26 15:29:31 -03:00
parent 234e333d6f
commit f40668a641
5 changed files with 27 additions and 13 deletions

View file

@ -9,6 +9,7 @@ on:
- 'deploy/**' - 'deploy/**'
- '**.md' - '**.md'
- 'images/**' # Images changes should be tested on their own workflow - 'images/**' # Images changes should be tested on their own workflow
- '!images/nginx-1.25/**'
push: push:
branches: branches:
@ -41,6 +42,7 @@ jobs:
outputs: outputs:
go: ${{ steps.filter.outputs.go }} go: ${{ steps.filter.outputs.go }}
charts: ${{ steps.filter.outputs.charts }} charts: ${{ steps.filter.outputs.charts }}
baseimage: ${{ steps.filter.outputs.baseimage }}
steps: steps:
@ -64,6 +66,8 @@ jobs:
- 'charts/ingress-nginx/Chart.yaml' - 'charts/ingress-nginx/Chart.yaml'
- 'charts/ingress-nginx/**/*' - 'charts/ingress-nginx/**/*'
- 'NGINX_BASE' - 'NGINX_BASE'
baseimage:
- 'images/nginx-1.25/**'
test-go: test-go:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -89,8 +93,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: | 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@ -120,6 +126,13 @@ jobs:
chmod +x ./kubectl chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/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 - name: Build images
env: env:
TAG: 1.0.0-dev TAG: 1.0.0-dev
@ -127,7 +140,8 @@ jobs:
REGISTRY: ingress-controller REGISTRY: ingress-controller
run: | run: |
echo "building images..." 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 make -C test/e2e-image image
echo "creating images cache..." echo "creating images cache..."
@ -154,7 +168,7 @@ jobs:
strategy: strategy:
matrix: 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: steps:
- name: Checkout - name: Checkout
@ -235,7 +249,7 @@ jobs:
(needs.changes.outputs.go == 'true') (needs.changes.outputs.go == 'true')
strategy: strategy:
matrix: 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 uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
with: with:
k8s-version: ${{ matrix.k8s }} k8s-version: ${{ matrix.k8s }}
@ -249,7 +263,7 @@ jobs:
(needs.changes.outputs.go == 'true') (needs.changes.outputs.go == 'true')
strategy: strategy:
matrix: 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 uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
with: with:
k8s-version: ${{ matrix.k8s }} k8s-version: ${{ matrix.k8s }}
@ -264,7 +278,7 @@ jobs:
(needs.changes.outputs.go == 'true') (needs.changes.outputs.go == 'true')
strategy: strategy:
matrix: 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 uses: ./.github/workflows/zz-tmpl-k8s-e2e.yaml
with: with:
k8s-version: ${{ matrix.k8s }} k8s-version: ${{ matrix.k8s }}

View file

@ -3,7 +3,7 @@ name: NGINX v1.25 Image
on: on:
pull_request: pull_request:
branches: branches:
- "*" - "kdsajdoiasjdoasijads"
paths: paths:
- 'images/nginx-1.25/**' - 'images/nginx-1.25/**'
push: push:

View file

@ -41,7 +41,8 @@ jobs:
env: env:
KIND_CLUSTER_NAME: kind KIND_CLUSTER_NAME: kind
SKIP_CLUSTER_CREATION: true SKIP_CLUSTER_CREATION: true
SKIP_IMAGE_CREATION: true SKIP_INGRESS_IMAGE_CREATION: true
SKIP_E2E_IMAGE_CREATION: true
ENABLE_VALIDATIONS: ${{ inputs.variation == 'VALIDATIONS' }} ENABLE_VALIDATIONS: ${{ inputs.variation == 'VALIDATIONS' }}
IS_CHROOT: ${{ inputs.variation == 'CHROOT' }} IS_CHROOT: ${{ inputs.variation == 'CHROOT' }}
run: | run: |

View file

@ -22,7 +22,7 @@ INIT_BUILDX=$(DIR)/../../hack/init-buildx.sh
# 0.0.0 shouldn't clobber any released builds # 0.0.0 shouldn't clobber any released builds
SHORT_SHA ?=$(shell git rev-parse --short HEAD) 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 REGISTRY ?= gcr.io/k8s-staging-ingress-nginx

View file

@ -1501,8 +1501,7 @@ func httpsListener(addresses []string, co string, tc *config.TemplateConfig) []s
} }
} }
lo = append(lo, co, "ssl") lo = append(lo, co, "ssl;")
lo = append(lo, ";")
out = append(out, strings.Join(lo, " ")) out = append(out, strings.Join(lo, " "))
} }