CI: Put the cosign pubkey and image-name.txt in the cache

And use this cache to overwrite the values before running the tests.
This commit is contained in:
Alexis Métaireau 2025-04-28 17:24:12 +02:00
parent 7f08b51dbd
commit bcbcf150fc
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E
2 changed files with 19 additions and 13 deletions

View file

@ -156,7 +156,7 @@ jobs:
debian_archive_date: ${{ needs.build.outputs.debian_archive_date }} debian_archive_date: ${{ needs.build.outputs.debian_archive_date }}
source_date_epoch: ${{ needs.build.outputs.source_date_epoch }} source_date_epoch: ${{ needs.build.outputs.source_date_epoch }}
image: ${{ needs.build.outputs.image }} image: ${{ needs.build.outputs.image }}
image_uri: ${{ needs.build.output.image }}@${{ steps.image.outputs.digest_root }}" image_uri: ${{ needs.build.outputs.image }}@${{ steps.image.outputs.digest_root }}
tag: ${{ needs.build.outputs.tag }} tag: ${{ needs.build.outputs.tag }}
digest_root: ${{ steps.image.outputs.digest_root }} digest_root: ${{ steps.image.outputs.digest_root }}
digest_amd64: ${{ steps.image.outputs.digest_amd64 }} digest_amd64: ${{ steps.image.outputs.digest_amd64 }}
@ -298,12 +298,6 @@ jobs:
name: Generate keypair name: Generate keypair
run: |- run: |-
cosign generate-key-pair --output-key-prefix="${{ inputs.key_name }}" cosign generate-key-pair --output-key-prefix="${{ inputs.key_name }}"
- name: Cache keypair
uses: actions/cache@v4
with:
path: "${{ inputs.key_name }}.*"
key: ${{ inputs.key_cache }}
enableCrossOsArchive: true
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -317,14 +311,15 @@ jobs:
cosign sign -d --yes --key=${{ inputs.key_name }}.key "${{ env.IMAGE_URI }}" cosign sign -d --yes --key=${{ inputs.key_name }}.key "${{ env.IMAGE_URI }}"
shell: bash shell: bash
- name: Get the container image from the registry - name: Prepare cached assets
# It contains the image and the signatures
run: |- run: |-
cosign save ${{ env.IMAGE_URI }} --dir dz-container cosign save ${{ env.IMAGE_URI }} --dir dz-container
mkdir share mkdir share
cd dz-container cd dz-container
tar -cvf ../share/container.tar . tar -cvf ../share/container.tar .
cd .. cd ..
mv ${{ inputs.key_name }}.pub share/freedomofpress-dangerzone-pub.key
echo "${{ inputs.registry }}/${{ inputs.image_name }}" > share/image-name.txt
- name: Cache container image - name: Cache container image
id: cache-container-image id: cache-container-image
@ -333,11 +328,13 @@ jobs:
key: v6-container-${{ env.IMAGE_URI }} key: v6-container-${{ env.IMAGE_URI }}
path: |- path: |-
share/container.tar share/container.tar
share/freedomofpress-dangerzone-pub.key
share/image-name.txt
- name: Upload pubkey - name: Upload pubkey
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: pubkey name: pubkey
path: "${{inputs.key_name}}.pub" path: share/freedomofpress-dangerzone-pub.key
if-no-files-found: error if-no-files-found: error
compression-level: 0 compression-level: 0

View file

@ -209,7 +209,10 @@ jobs:
- name: Restore container image - name: Restore container image
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: share/container.tar path: |-
share/container.tar
share/freedomofpress-dangerzone-pub.key
share/image-name.txt
enableCrossOsArchive: true enableCrossOsArchive: true
fail-on-cache-miss: true fail-on-cache-miss: true
key: v6-container-${{ needs.build-container-image.outputs.image_uri }} key: v6-container-${{ needs.build-container-image.outputs.image_uri }}
@ -315,7 +318,10 @@ jobs:
- name: Restore container image - name: Restore container image
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: share/container.tar path: |-
share/container.tar
share/freedomofpress-dangerzone-pub.key
share/image-name.txt
enableCrossOsArchive: true enableCrossOsArchive: true
fail-on-cache-miss: true fail-on-cache-miss: true
key: v6-container-${{ needs.build-container-image.outputs.image_uri }} key: v6-container-${{ needs.build-container-image.outputs.image_uri }}
@ -411,7 +417,10 @@ jobs:
- name: Restore container image - name: Restore container image
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: share/container.tar path: |-
share/container.tar
share/freedomofpress-dangerzone-pub.key
share/image-name.txt
enableCrossOsArchive: true enableCrossOsArchive: true
fail-on-cache-miss: true fail-on-cache-miss: true
key: v6-container-${{ needs.build-container-image.outputs.image_uri }} key: v6-container-${{ needs.build-container-image.outputs.image_uri }}