diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cdd3dc2ae0..2fbc93e309 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,9 @@ on: required: false type: string default: 'ubuntu-24.04' + outputs: + image_version: + value: ${{ jobs.build.outputs.image_version }} defaults: run: @@ -41,6 +44,8 @@ jobs: packages: write # for docker/build-push-action to push to GHCR id-token: write # for docker/login to login to NGINX registry runs-on: ${{ inputs.runner }} + outputs: + image_version: ${{ steps.meta.outputs.version }} services: registry: image: registry:3 @@ -193,3 +198,18 @@ jobs: with: sarif_file: ${{ steps.scan.outputs.sarif }} category: build-${{ inputs.image }} + + - name: Show all image tags for debugging + run: echo "${{ steps.meta.outputs.tags }}" + + - name: Pull and save image artifact for linux/amd64 + if: ${{ inputs.build-os == 'ubi' && !inputs.dry_run }} + run: | + docker pull --platform=linux/amd64 localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ steps.meta.outputs.version }} + docker save localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ steps.meta.outputs.version }} -o ${{ inputs.image }}-${{ steps.meta.outputs.version }}.tar + + - name: Upload all image artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.image }}-${{ steps.meta.outputs.version }} + path: ${{ inputs.image }}-${{ steps.meta.outputs.version }}.tar \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10b86dd949..b9f904fa39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -409,6 +409,27 @@ jobs: id-token: write # for docker/login to login to NGINX registry secrets: inherit + openshift-certification: + name: OpenShift Certification + needs: [build-oss, build-plus, build-operator] + strategy: + fail-fast: false + matrix: + image: [ngf, nginx, operator] + # if: ${{ github.event_name == 'pull_request' && github.event_pull_request.base.ref == 'main' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (inputs.is_production_release == true) }} + uses: ./.github/workflows/openshift-certification.yml + with: + runner: ubuntu-24.04 + image: ${{ matrix.image }} + image_version: > + ${{ matrix.image == 'ngf' && needs.build-oss.outputs.image_version + || matrix.image == 'nginx' && needs.build-oss.outputs.image_version + || matrix.image == 'operator' && needs.build-operator.outputs.image_version }} + permissions: + contents: read + packages: read + secrets: inherit + functional-tests: name: Functional tests needs: [vars, build-oss, build-plus] diff --git a/.github/workflows/openshift-certification.yml b/.github/workflows/openshift-certification.yml new file mode 100644 index 0000000000..8ac950b675 --- /dev/null +++ b/.github/workflows/openshift-certification.yml @@ -0,0 +1,65 @@ +name: OpenShift Certification + +on: + workflow_call: + inputs: + runner: + required: false + type: string + default: 'ubuntu-24.04' + image: + required: true + type: string + image_version: + required: true + type: string + +defaults: + run: + shell: bash + +permissions: + contents: read + +jobs: + preflight: + runs-on: ${{ inputs.runner }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download preflight binary + run: | + curl -LO https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/latest/download/preflight-linux-amd64 + chmod +x preflight-linux-amd64 + sudo mv preflight-linux-amd64 /usr/local/bin/preflight + + - name: Download image artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.image }}-${{ inputs.image_version }} + + - name: Load image into Docker + run: | + docker load -i ${{ inputs.image }}-${{ inputs.image_version }}.tar + + - name: Retag image for preflight + run: | + loaded_tag="localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ inputs.image_version }}" + preflight_tag="${{ inputs.image }}:ubi" + docker tag "$loaded_tag" "$preflight_tag" + + - name: Run preflight + env: + PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }} + run: preflight check container ${{ inputs.image }}:ubi > preflight-result.json + + - name: Check preflight results + run: | + failed_count=$(jq '.results.failed | length' preflight-result.json) + if [ "$failed_count" -ne 0 ]; then + echo "Preflight checks failed: $failed_count failed checks" + echo "Results for preflight-result.json:" + jq '.results.failed' preflight-result.json + exit 1 + fi \ No newline at end of file