diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae69d626dd..135cd173a4 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 512fdcf2fd..dfc42628a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -359,7 +359,7 @@ jobs: platforms: ${{ matrix.platforms }} build-os: ${{ matrix.build-os }} tag: ${{ inputs.release_version || '' }} - dry_run: ${{ inputs.dry_run || false}} + 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' }} permissions: contents: read # for docker/build-push-action to read repo content @@ -407,6 +407,27 @@ jobs: id-token: write # for docker/login to login to NGINX registry secrets: inherit + openshift-certification: + name: OpenShift Certification + needs: [build-oss, build-operator] + strategy: + fail-fast: false + matrix: + image: [ngf, nginx, operator] + platform: ["amd64", "arm64"] + 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: + image: ${{ matrix.image }} + platform: ${{ matrix.platform }} + tag: ${{ inputs.release_version || '' }} + dry_run: ${{ inputs.dry_run || false }} + image_version: ${{ (matrix.image == 'ngf' && endsWith(needs.build-oss.outputs.image_version, '-ubi')) && needs.build-oss.outputs.image_version || (matrix.image == 'nginx' && endsWith(needs.build-oss.outputs.image_version, '-ubi')) && 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..fed3b8f87d --- /dev/null +++ b/.github/workflows/openshift-certification.yml @@ -0,0 +1,73 @@ +name: OpenShift Certification + +on: + workflow_call: + inputs: + image: + required: true + type: string + platform: + required: true + type: string + image_version: + required: true + type: string + tag: + required: false + type: string + default: '' + dry_run: + required: false + type: boolean + default: false + +defaults: + run: + shell: bash + +permissions: + contents: read + +jobs: + preflight: + runs-on: ubuntu-24.04 + steps: + - name: Checkout Repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + ref: ${{ (inputs.tag != '' && !inputs.dry_run ) && format('refs/tags/v{0}', inputs.tag) || github.ref }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 + if: ${{ github.event_name != 'pull_request' && ! contains(inputs.image, 'plus') }} + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - 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: Run preflight + env: + PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }} + run: | + if [[ "${{ inputs.image }}" == "ngf" ]]; then + IMAGE_PATH="ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric:${{ inputs.image_version }}" + else + IMAGE_PATH="ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric/${{ inputs.image }}:${{ inputs.image_version }}" + fi + preflight check container "$IMAGE_PATH" --platform ${{ inputs.platform }} > 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