mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-01 20:56:02 +09:00
A release has signed its assets since #4861, but not the container images a cluster installed from it pulls, and the SBOM each image carries since #4997 sat in the registry only, readable with buildx and signed by nothing. A user could verify the ISO they booted and not the platform it installed. hack/sign-release-images.sh signs every first-party digest the repinned tree holds with cosign, keylessly, in prepare-release after the stitch, one cosign call per digest so that cosign's per-call timeout does not grow with the number of images. It skips a digest that already verifies, so a re-run stacks no second signature, and verifies each one against the identity docs/release/signatures-and-sbom.md names before hack/upload-assets.sh runs, so nothing is uploaded over an unsigned image. The draft release is created only after that step, so a failed signing run leaves no draft for a re-run to take for a finished release. The signature over an index covers the attestation manifest the index lists, so the SBOM needs none of its own, and cosign stores it as a referrer of the digest in the repository hack/promote-retag.sh copies the digest within, so promote-rc.yaml only verifies, with the rc tree's script, before it stages the stable release, and prints cosign's reason for every digest that fails. hack/collect-image-sboms.sh reads the SBOM attestation of every such image back into cozystack-images-sbom.tar.gz, one SPDX document per platform, and fails on an image that lacks one for any platform its index serves. With cozystack-images.txt, the digests the signatures are bound to, both join the asset list hack/upload-assets.sh hands to hack/sign-release-assets.sh, so the existing checksums signature covers them. docs/release/signatures-and-sbom.md gains the verification recipe for a whole release, which requires a signed checksum entry for each of the two image assets; cozystack-scheduler, whose image a separate repository builds, is not in the list. The bats files pin the scripts, the recipe, the upload list and the two workflow steps. Refs #2937, #3278 Assisted-by: LLM Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua>
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -xe
|
|
|
|
version=${VERSION:-$(git describe --tags)}
|
|
|
|
assets=(
|
|
_out/assets/cozystack-crds.yaml
|
|
_out/assets/cozystack-operator-talos.yaml
|
|
_out/assets/cozystack-operator-generic.yaml
|
|
_out/assets/cozystack-operator-hosted.yaml
|
|
)
|
|
for arch in amd64 arm64; do
|
|
assets+=(
|
|
"_out/assets/metal-$arch.iso"
|
|
"_out/assets/metal-$arch.raw.xz"
|
|
"_out/assets/nocloud-$arch.raw.xz"
|
|
"_out/assets/kernel-$arch"
|
|
"_out/assets/initramfs-metal-$arch.xz"
|
|
)
|
|
done
|
|
assets+=(
|
|
_out/assets/cozypkg-*.tar.gz
|
|
_out/assets/cozypkg-checksums.txt
|
|
_out/assets/openapi.json
|
|
# Written by hack/sign-release-images.sh and hack/collect-image-sboms.sh in
|
|
# prepare-release, before this runs: the images the release pins and their
|
|
# SBOMs, which the checksums below then cover.
|
|
_out/assets/cozystack-images.txt
|
|
_out/assets/cozystack-images-sbom.tar.gz
|
|
)
|
|
|
|
# Before the first upload, so that a release never carries assets without the
|
|
# signature over them: if signing fails, nothing is uploaded.
|
|
hack/sign-release-assets.sh "$version" "${assets[@]}"
|
|
|
|
for asset in "${assets[@]}" \
|
|
_out/assets/cozystack-source-sbom.spdx.json \
|
|
_out/assets/cozystack-checksums.txt \
|
|
_out/assets/cozystack-checksums.txt.sigstore.json; do
|
|
gh release upload --clobber "$version" "$asset"
|
|
done
|