diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5deb48953..3b718c61f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,10 @@ on: platforms: required: true type: string + build-os: + required: false + type: string + default: '' image: required: true type: string @@ -120,12 +124,12 @@ jobs: flavor: | latest=${{ (inputs.tag != '' && 'true') || 'auto' }} tags: | - type=semver,pattern={{version}} - type=edge - type=schedule - type=ref,event=pr - type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && inputs.tag == '' }} - type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }} + type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && inputs.tag == '' }} + type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} labels: | org.opencontainers.image.documentation=https://docs.nginx.com/nginx-gateway-fabric org.opencontainers.image.vendor=NGINX Inc @@ -143,7 +147,7 @@ jobs: - name: Build Docker Image uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: - file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }} + file: ${{ inputs.build-os != '' && format('build/{0}/Dockerfile{1}', inputs.build-os, inputs.image == 'nginx' && '.nginx' || inputs.image == 'plus' && '.nginxplus' || '') || format('build/Dockerfile{0}', inputs.image == 'nginx' && '.nginx' || inputs.image == 'plus' && '.nginxplus' || '') }} context: "." target: ${{ inputs.image == 'ngf' && 'goreleaser' || '' }} tags: ${{ steps.meta.outputs.tags }} @@ -151,8 +155,8 @@ jobs: annotations: ${{ steps.meta.outputs.annotations }} push: ${{ !inputs.dry_run }} platforms: ${{ inputs.platforms }} - cache-from: type=gha,scope=${{ inputs.image }} - cache-to: type=gha,scope=${{ inputs.image }},mode=max + cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + cache-to: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},mode=max pull: true no-cache: ${{ github.event_name != 'pull_request' }} sbom: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba9cb95e26..44b0e7c163 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -234,10 +234,12 @@ jobs: matrix: image: [ngf, nginx] platforms: ["linux/arm64, linux/amd64"] + build-os: ["", ubi] uses: ./.github/workflows/build.yml with: image: ${{ matrix.image }} platforms: ${{ matrix.platforms }} + build-os: ${{ matrix.build-os }} tag: ${{ inputs.release_version || '' }} dry_run: ${{ inputs.dry_run || false}} runner: ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }} @@ -252,9 +254,14 @@ jobs: name: Build Plus images needs: [vars, binary] uses: ./.github/workflows/build.yml + strategy: + fail-fast: false + matrix: + build-os: ["", ubi] with: image: plus platforms: "linux/arm64, linux/amd64" + build-os: ${{ matrix.build-os }} tag: ${{ inputs.release_version || '' }} dry_run: ${{ inputs.dry_run || false }} runner: ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }} @@ -272,6 +279,7 @@ jobs: fail-fast: false matrix: image: [nginx, plus] + build-os: ["", ubi] k8s-version: [ "${{ needs.vars.outputs.min_k8s_version }}", @@ -281,6 +289,7 @@ jobs: with: image: ${{ matrix.image }} k8s-version: ${{ matrix.k8s-version }} + build-os: ${{ matrix.build-os }} secrets: inherit permissions: contents: read @@ -292,6 +301,7 @@ jobs: fail-fast: false matrix: image: [nginx, plus] + build-os: ["", ubi] k8s-version: [ "${{ needs.vars.outputs.min_k8s_version }}", @@ -303,6 +313,7 @@ jobs: image: ${{ matrix.image }} k8s-version: ${{ matrix.k8s-version }} enable-experimental: ${{ matrix.enable-experimental }} + build-os: ${{ matrix.build-os }} production-release: ${{ inputs.is_production_release == true && (inputs.dry_run == false || inputs.dry_run == null) }} release_version: ${{ inputs.release_version }} secrets: inherit diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index f8ce171f53..92dcad608c 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -6,6 +6,10 @@ on: image: required: true type: string + build-os: + required: false + type: string + default: '' k8s-version: required: true type: string @@ -75,12 +79,12 @@ jobs: images: | name=ghcr.io/nginx/nginx-gateway-fabric tags: | - type=semver,pattern={{version}} - type=edge - type=schedule - type=ref,event=pr - type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }} - type=raw,value={{inputs.release_version}},enable=${{ inputs.production-release && inputs.release_version != '' }} + type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }} + type=raw,value={{ inputs.release_version }},enable=${{ inputs.production-release && inputs.release_version != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} - name: NGINX Docker meta id: nginx-meta @@ -89,12 +93,12 @@ jobs: images: | name=ghcr.io/nginx/nginx-gateway-fabric/${{ inputs.image == 'plus' && 'nginx-plus' || inputs.image }} tags: | - type=semver,pattern={{version}} - type=edge - type=schedule - type=ref,event=pr - type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }} - type=raw,value={{inputs.release_version}},enable=${{ inputs.production-release && inputs.release_version != '' }} + type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') && !inputs.production-release }} + type=raw,value={{ inputs.release_version }},enable=${{ inputs.production-release && inputs.release_version != '' }},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} - name: Build binary uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 @@ -119,11 +123,11 @@ jobs: - name: Build NGINX Docker Image uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: - file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || ''}} + file: build${{ inputs.build-os != '' && format('/{0}', inputs.build-os) || '' }}/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }} tags: ${{ steps.nginx-meta.outputs.tags }} context: "." load: true - cache-from: type=gha,scope=${{ inputs.image }} + cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} pull: true build-args: | NJS_DIR=internal/controller/nginx/modules/src @@ -178,7 +182,7 @@ jobs: if: ${{ inputs.enable-experimental }} uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: conformance-profile-${{ inputs.image }}-${{ inputs.k8s-version }} + name: conformance-profile-${{ inputs.image }}-${{ inputs.k8s-version }}-${{ steps.ngf-meta.outputs.version }} path: ./tests/conformance-profile.yaml - name: Upload profile to release diff --git a/.github/workflows/functional.yml b/.github/workflows/functional.yml index 2bb06f09a4..bba8fb758f 100644 --- a/.github/workflows/functional.yml +++ b/.github/workflows/functional.yml @@ -9,6 +9,10 @@ on: k8s-version: required: true type: string + build-os: + required: false + type: string + default: '' defaults: run: @@ -61,11 +65,11 @@ jobs: images: | name=ghcr.io/nginx/nginx-gateway-fabric tags: | - type=semver,pattern={{version}} - type=schedule - type=edge - type=ref,event=pr - type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }} + type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') }} - name: NGINX Docker meta id: nginx-meta @@ -74,16 +78,16 @@ jobs: images: | name=ghcr.io/nginx/nginx-gateway-fabric/${{ inputs.image == 'plus' && 'nginx-plus' || inputs.image }} tags: | - type=semver,pattern={{version}} - type=edge - type=schedule - type=ref,event=pr - type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }} + type=semver,pattern={{version}},suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=schedule,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=edge,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=pr,suffix=${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} + type=ref,event=branch,suffix=-rc${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }},enable=${{ startsWith(github.ref, 'refs/heads/release') }} - name: Build binary uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: - version: v2.12.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser + version: v2.12.3 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: build --single-target --snapshot --clean env: TELEMETRY_ENDPOINT: otel-collector-opentelemetry-collector.collector.svc.cluster.local:4317 @@ -103,11 +107,11 @@ jobs: - name: Build NGINX Docker Image uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: - file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || ''}} + file: build${{ inputs.build-os != '' && format('/{0}', inputs.build-os) || '' }}/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }} tags: ${{ steps.nginx-meta.outputs.tags }} context: "." load: true - cache-from: type=gha,scope=${{ inputs.image }} + cache-from: type=gha,scope=${{ inputs.image }}${{ inputs.build-os != '' && format('-{0}', inputs.build-os) || '' }} pull: true build-args: | NJS_DIR=internal/controller/nginx/modules/src diff --git a/build/ubi/Dockerfile.nginx b/build/ubi/Dockerfile.nginx index 71adbb37e7..6f2829f6d3 100644 --- a/build/ubi/Dockerfile.nginx +++ b/build/ubi/Dockerfile.nginx @@ -52,7 +52,7 @@ RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \ # Forward request and error logs to docker log collector && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \ - && mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ + && cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ # Set proper permissions for nginx user RUN chown -R 101:1001 /etc/nginx /var/cache/nginx diff --git a/build/ubi/Dockerfile.nginxplus b/build/ubi/Dockerfile.nginxplus index 6224136c09..c61d3d0ae8 100644 --- a/build/ubi/Dockerfile.nginxplus +++ b/build/ubi/Dockerfile.nginxplus @@ -59,7 +59,7 @@ RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \ # Forward request and error logs to docker log collector && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \ - && mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ + && cp /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ # Copy default html files to a writable location RUN mkdir -p /etc/nginx/html \