diff --git a/.github/workflows/__e2e_chainsaw_tests.yaml b/.github/workflows/__e2e_chainsaw_tests.yaml index 27f18e31e7..a744f1ee29 100644 --- a/.github/workflows/__e2e_chainsaw_tests.yaml +++ b/.github/workflows/__e2e_chainsaw_tests.yaml @@ -8,6 +8,10 @@ on: description: "Kind node image version" type: string required: true + artifacts_run_id: + description: "Workflow run id that produced the e2e image artifact" + type: string + required: true permissions: contents: read @@ -32,8 +36,15 @@ jobs: egress-policy: audit - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: build docker image - run: make docker.build + - name: download e2e image artifact + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 + with: + name: kong-operator-e2e-image-${{ inputs.artifacts_run_id }} + run-id: ${{ inputs.artifacts_run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: load docker image + run: docker load -i kong-operator_e2e.tar - uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ccabbf623c..6f85846fab 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,6 +42,40 @@ env: MISE_VERBOSE: 1 jobs: + build-e2e-image: + runs-on: ubuntu-latest + needs: [check-docs-only] + if: ${{ needs.check-docs-only.outputs.docs_only != 'true' }} + env: + IMG: kong-operator + TAG: e2e-${{ github.sha }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 + with: + egress-policy: audit + - name: checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: setup golang + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 + with: + go-version-file: go.mod + + - name: build docker image + run: make docker.build + + - name: save docker image as artifact + run: docker save ${{ env.IMG }}:${{ env.TAG }} -o kong-operator_e2e.tar + + - name: upload docker image artifact + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: kong-operator-e2e-image-${{ github.run_id }} + path: kong-operator_e2e.tar + retention-days: 1 + if-no-files-found: error + check-docs-only: runs-on: ubuntu-latest outputs: @@ -398,7 +432,7 @@ jobs: e2e-tests: runs-on: ubuntu-latest - needs: [check-docs-only] + needs: [check-docs-only, build-e2e-image] if: ${{ needs.check-docs-only.outputs.docs_only != 'true' }} steps: - name: Harden Runner @@ -415,11 +449,13 @@ jobs: with: go-version-file: go.mod - - name: build docker image - env: - IMG: kong-operator - TAG: e2e-${{ github.sha }} - run: make docker.build + - name: download e2e image artifact + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 + with: + name: kong-operator-e2e-image-${{ github.run_id }} + + - name: load docker image + run: docker load -i kong-operator_e2e.tar - uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3 with: @@ -449,12 +485,14 @@ jobs: e2e-tests-chainsaw: needs: - check-docs-only + - build-e2e-image - matrix_k8s_node_versions if: ${{ needs.check-docs-only.outputs.docs_only != 'true' }} uses: ./.github/workflows/__e2e_chainsaw_tests.yaml secrets: inherit with: node_image_version: ${{ needs.matrix_k8s_node_versions.outputs.latest }} + artifacts_run_id: ${{ github.run_id }} buildpulse-report: needs: @@ -509,6 +547,7 @@ jobs: - samples - install-with-kustomize - build + - build-e2e-image - CRDs - unit-tests - envtest-tests