From 45bd451fa0612658f0d8650bc7d42f8b5d7ed0e2 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 29 Jan 2025 18:50:02 +0000 Subject: [PATCH] ci: add arm64 attestation Do the very same thing that we do on amd64 and add attestation Signed-off-by: Zvonko Kaiser --- .../build-kata-static-tarball-arm64.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/build-kata-static-tarball-arm64.yaml b/.github/workflows/build-kata-static-tarball-arm64.yaml index 2c935d4691..180c806caf 100644 --- a/.github/workflows/build-kata-static-tarball-arm64.yaml +++ b/.github/workflows/build-kata-static-tarball-arm64.yaml @@ -24,6 +24,11 @@ on: jobs: build-asset: runs-on: ubuntu-22.04-arm + permissions: + contents: read + packages: write + id-token: write + attestations: write strategy: matrix: asset: @@ -38,6 +43,8 @@ jobs: - qemu - stratovirt - virtiofsd + env: + PERFORM_ATTESTATION: ${{ matrix.asset == 'agent' && inputs.push-to-registry == 'yes' && 'yes' || 'no' }} steps: - name: Login to Kata Containers quay.io if: ${{ inputs.push-to-registry == 'yes' }} @@ -74,6 +81,34 @@ jobs: TARGET_BRANCH: ${{ inputs.target-branch }} RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} + - name: Parse OCI image name and digest + id: parse-oci-segments + if: ${{ env.PERFORM_ATTESTATION == 'yes' }} + run: | + oci_image="$(<"build/${{ matrix.asset }}-oci-image")" + echo "oci-name=${oci_image%@*}" >> "$GITHUB_OUTPUT" + echo "oci-digest=${oci_image#*@}" >> "$GITHUB_OUTPUT" + + - uses: oras-project/setup-oras@v1 + if: ${{ env.PERFORM_ATTESTATION == 'yes' }} + with: + version: "1.2.0" + + # for pushing attestations to the registry + - uses: docker/login-action@v3 + if: ${{ env.PERFORM_ATTESTATION == 'yes' }} + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/attest-build-provenance@v1 + if: ${{ env.PERFORM_ATTESTATION == 'yes' }} + with: + subject-name: ${{ steps.parse-oci-segments.outputs.oci-name }} + subject-digest: ${{ steps.parse-oci-segments.outputs.oci-digest }} + push-to-registry: true + - name: store-artifact ${{ matrix.asset }} uses: actions/upload-artifact@v4 with: