@@ -205,13 +205,17 @@ jobs:
205205 permissions:
206206 id-token: write
207207 runs-on: ubuntu-latest
208+ outputs:
209+ oci-index-digest: ${{ steps.publish-oci.outputs.image-index-manifest-digest }}
210+ quay-index-digest: ${{ steps.publish-quay.outputs.image-index-manifest-digest }}
208211 steps:
209212 - name: Checkout Repository
210213 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
211214 with:
212215 persist-credentials: false
213216
214217 - name: Publish and Sign Image Index to oci.stackable.tech
218+ id: publish-oci
215219 uses: stackabletech/actions/publish-image-index-manifest@a14cbd08d9e034e2361ea9205b32aff0491885db # v0.15.0
216220 with:
217221 image-registry-uri: oci.stackable.tech
@@ -221,6 +225,7 @@ jobs:
221225 image-index-manifest-tag: ${{ needs.build-container-image.outputs.operator-version }}
222226
223227 - name: Publish and Sign Image Index to quay.io
228+ id: publish-quay
224229 uses: stackabletech/actions/publish-image-index-manifest@a14cbd08d9e034e2361ea9205b32aff0491885db # v0.15.0
225230 with:
226231 image-registry-uri: quay.io
@@ -229,6 +234,62 @@ jobs:
229234 image-repository: stackable/sdp/${{ env.OPERATOR_NAME }}
230235 image-index-manifest-tag: ${{ needs.build-container-image.outputs.operator-version }}
231236
237+ # Generate SLSA build provenance for the multi-arch image index and attach it
238+ # to the published image in each registry. The reusable workflow signs the
239+ # provenance with keyless signing (GitHub Actions as the OIDC identity) and
240+ # pushes the attestation next to the image.
241+ provenance-oci:
242+ name: Generate Provenance for ${{ needs.build-container-image.outputs.operator-version }} (oci.stackable.tech)
243+ if: |
244+ (github.event_name != 'merge_group')
245+ && needs.detect-changes.outputs.detected == 'true'
246+ && !github.event.pull_request.head.repo.fork
247+ needs:
248+ - detect-changes
249+ - publish-index-manifest
250+ permissions:
251+ actions: read # detect the build workflow that generated the image
252+ id-token: write # mint the OIDC token for keyless signing
253+ packages: write # needed until https://github.com/slsa-framework/slsa-github-generator/issues/1257 is resolved
254+ # MUST be referenced by a @vX.Y.Z tag (not a SHA), otherwise the reusable
255+ # workflow cannot verify its own provenance.
256+ uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
257+ with:
258+ # The 'env' context is not available in job-level 'with' inputs of
259+ # reusable workflow calls (unlike step-level 'with'), so OPERATOR_NAME
260+ # can't be used here and the operator name is templated in directly.
261+ image: oci.stackable.tech/sdp/{[ operator.name }]
262+ digest: ${{ needs.publish-index-manifest.outputs.oci-index-digest }}
263+ registry-username: robot$sdp+github-action-build
264+ secrets:
265+ registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
266+
267+ provenance-quay:
268+ name: Generate Provenance for ${{ needs.build-container-image.outputs.operator-version }} (quay.io)
269+ if: |
270+ (github.event_name != 'merge_group')
271+ && needs.detect-changes.outputs.detected == 'true'
272+ && !github.event.pull_request.head.repo.fork
273+ needs:
274+ - detect-changes
275+ - publish-index-manifest
276+ permissions:
277+ actions: read # detect the build workflow that generated the image
278+ id-token: write # mint the OIDC token for keyless signing
279+ packages: write # needed until https://github.com/slsa-framework/slsa-github-generator/issues/1257 is resolved
280+ # MUST be referenced by a @vX.Y.Z tag (not a SHA), otherwise the reusable
281+ # workflow cannot verify its own provenance.
282+ uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
283+ with:
284+ # The 'env' context is not available in job-level 'with' inputs of
285+ # reusable workflow calls (unlike step-level 'with'), so OPERATOR_NAME
286+ # can't be used here and the operator name is templated in directly.
287+ image: quay.io/stackable/sdp/{[ operator.name }]
288+ digest: ${{ needs.publish-index-manifest.outputs.quay-index-digest }}
289+ registry-username: stackable+robot_sdp_github_action_build
290+ secrets:
291+ registry-password: ${{ secrets.QUAY_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
292+
232293 publish-helm-chart:
233294 name: Package/Publish ${{ needs.build-container-image.outputs.operator-version }} Helm Chart
234295 if: |
@@ -328,6 +389,8 @@ jobs:
328389 - detect-changes
329390 - build-container-image
330391 - publish-index-manifest
392+ - provenance-oci
393+ - provenance-quay
331394 - publish-helm-chart
332395 runs-on: ubuntu-latest
333396 steps:
0 commit comments