CI: Use a GH variable for IMAGE_URI

This commit is contained in:
Alexis Métaireau 2025-04-28 15:09:13 +02:00
parent aca68567da
commit 1cece70173
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E

View file

@ -273,8 +273,13 @@ jobs:
COSIGN_YES: true COSIGN_YES: true
needs: needs:
- merge - merge
# outputs: add signature location ? outputs:
image_uri: ${{ steps.params.outputs.image_uri }}
steps: steps:
- name: Prepare env
run: |-
echo "IMAGE_URI=${{ inputs.registry }}/${{ inputs.image_name }}:${{ needs.merge.outputs.tag }}@${{ needs.merge.outputs.digest_root }}" >> $GITHUB_ENV
- name: Install Cosign - name: Install Cosign
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a
with: with:
@ -309,15 +314,14 @@ jobs:
- name: Sign container - name: Sign container
run: |- run: |-
export IMAGE_URI="${{ inputs.registry }}/${{ inputs.image_name }}:${{ needs.merge.outputs.tag }}@${{ needs.merge.outputs.digest_root }}" cosign sign -d --yes --key=${{ inputs.key_name }}.key "${{ env.IMAGE_URI }}"
cosign sign -d --yes --key=${{ inputs.key_name }}.key "$IMAGE_URI"
shell: bash shell: bash
- name: Get the container image from the registry - name: Get the container image from the registry
# It contains the image and the signatures # It contains the image and the signatures
run: |- run: |-
export IMAGE_URI="${{ inputs.registry }}/${{ inputs.image_name }}:${{ needs.merge.outputs.tag }}@${{ needs.merge.outputs.digest_root }}" cosign save ${{ env.IMAGE_URI }} --dir dz-container
cosign save $IMAGE_URI --dir dz-container mkdir share
cd dz-container cd dz-container
tar -cvf ../share/container.tar . tar -cvf ../share/container.tar .
cd .. cd ..
@ -326,7 +330,7 @@ jobs:
id: cache-container-image id: cache-container-image
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
key: v6-container-${{ inputs.registry }}/${{ inputs.image_name }}:${{ needs.merge.outputs.tag }}@${{ needs.merge.outputs.digest_root }}" key: v6-container-${{ env.IMAGE_URI }}
path: |- path: |-
share/container.tar share/container.tar