ci : add attestation for signed release artifacts (#25933)
This commit is contained in:
@@ -394,6 +394,11 @@ jobs:
|
|||||||
name: Create shared tags from digests
|
name: Create shared tags from digests
|
||||||
needs: [prepare_matrices, push_to_registry, create_tag]
|
needs: [prepare_matrices, push_to_registry, create_tag]
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -428,6 +433,7 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Create tags from digests
|
- name: Create tags from digests
|
||||||
|
id: create_tags
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -439,6 +445,7 @@ jobs:
|
|||||||
SRC_TAG="${{ needs.create_tag.outputs.source_tag }}"
|
SRC_TAG="${{ needs.create_tag.outputs.source_tag }}"
|
||||||
BUILD_DATE="${{ steps.build_date.outputs.date }}"
|
BUILD_DATE="${{ steps.build_date.outputs.date }}"
|
||||||
COMMIT_SHA="${{ steps.checkout.outputs.commit }}"
|
COMMIT_SHA="${{ steps.checkout.outputs.commit }}"
|
||||||
|
echo "image_repo=${IMAGE_REPO}" >> "$GITHUB_OUTPUT"
|
||||||
TAGS="${{ matrix.config.tag }}"
|
TAGS="${{ matrix.config.tag }}"
|
||||||
ARCHES="${{ matrix.config.arches }}"
|
ARCHES="${{ matrix.config.arches }}"
|
||||||
DIGEST_GLOB="/tmp/digests/*.tsv"
|
DIGEST_GLOB="/tmp/digests/*.tsv"
|
||||||
@@ -505,6 +512,16 @@ jobs:
|
|||||||
|
|
||||||
echo "Creating ${merged_versioned_tag} from ${refs[*]}"
|
echo "Creating ${merged_versioned_tag} from ${refs[*]}"
|
||||||
docker buildx imagetools create "${annotations[@]}" --tag "${merged_versioned_tag}" "${refs[@]}"
|
docker buildx imagetools create "${annotations[@]}" --tag "${merged_versioned_tag}" "${refs[@]}"
|
||||||
|
|
||||||
|
if [[ "$tag_name" == "${TAGS%% *}" ]]; then
|
||||||
|
local digest
|
||||||
|
digest="$(docker buildx imagetools inspect "${merged_versioned_tag}" --format '{{.Manifest.Digest}}')"
|
||||||
|
if [[ ! "$digest" =~ ^sha256:[0-9a-f]{64}$ ]]; then
|
||||||
|
echo "Invalid digest for ${merged_versioned_tag}: ${digest}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "${image_type}_digest=${digest}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
for tag in $TAGS; do
|
for tag in $TAGS; do
|
||||||
@@ -528,3 +545,24 @@ jobs:
|
|||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
GITHUB_REPOSITORY_OWNER: '${{ github.repository_owner }}'
|
GITHUB_REPOSITORY_OWNER: '${{ github.repository_owner }}'
|
||||||
|
|
||||||
|
- name: Attest full image
|
||||||
|
if: ${{ matrix.config.full }}
|
||||||
|
uses: actions/attest@v4
|
||||||
|
with:
|
||||||
|
subject-name: ${{ steps.create_tags.outputs.image_repo }}
|
||||||
|
subject-digest: ${{ steps.create_tags.outputs.full_digest }}
|
||||||
|
|
||||||
|
- name: Attest light image
|
||||||
|
if: ${{ matrix.config.light }}
|
||||||
|
uses: actions/attest@v4
|
||||||
|
with:
|
||||||
|
subject-name: ${{ steps.create_tags.outputs.image_repo }}
|
||||||
|
subject-digest: ${{ steps.create_tags.outputs.light_digest }}
|
||||||
|
|
||||||
|
- name: Attest server image
|
||||||
|
if: ${{ matrix.config.server }}
|
||||||
|
uses: actions/attest@v4
|
||||||
|
with:
|
||||||
|
subject-name: ${{ steps.create_tags.outputs.image_repo }}
|
||||||
|
subject-digest: ${{ steps.create_tags.outputs.server_digest }}
|
||||||
|
|||||||
@@ -1569,6 +1569,8 @@ jobs:
|
|||||||
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
|
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for creating release
|
contents: write # for creating release
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
runs-on: ubuntu-slim
|
runs-on: ubuntu-slim
|
||||||
|
|
||||||
@@ -1662,6 +1664,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
tar -czvf release/llama-${{ steps.tag.outputs.name }}-ui.tar.gz --transform "s,^\.,llama-${{ steps.tag.outputs.name }}," -C ./ui-dist .
|
tar -czvf release/llama-${{ steps.tag.outputs.name }}-ui.tar.gz --transform "s,^\.,llama-${{ steps.tag.outputs.name }}," -C ./ui-dist .
|
||||||
|
|
||||||
|
- name: Attest release artifacts
|
||||||
|
uses: actions/attest@v4
|
||||||
|
with:
|
||||||
|
subject-path: 'release/*'
|
||||||
|
|
||||||
- name: Create and push git tag
|
- name: Create and push git tag
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.name }}"
|
TAG="${{ steps.tag.outputs.name }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user