tag / tag (push) Skipped
Trivy and gitleaks were pinned (version + tarball SHA-256 + image digest) with nothing to bump them. Renovate (tth/renovate) now does; .gitea/update-checksums.sh recomputes the SHA-256s after a bump and checks them against the release checksums file; pr-check.yml runs the PR's actions with the Trivy container and with the pinned binary (checksum verified); tag.yml cuts the next vN after renovate-bot's merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.7 KiB
Bash
48 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
# Recompute the pinned SHA-256 of the Trivy and gitleaks release tarballs
|
|
# after a version bump. Renovate runs it as a postUpgradeTask (tth/renovate
|
|
# config.json), so a bump PR carries matching checksums; by hand:
|
|
# bash .gitea/update-checksums.sh
|
|
#
|
|
# Each tarball is downloaded and hashed here, and the hash must ALSO match
|
|
# the release's own checksums file - the pin is what we verified at bump
|
|
# time, the action then refuses any other bytes.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
work=$(mktemp -d)
|
|
trap 'rm -rf "$work"' EXIT
|
|
|
|
# pin <action.yml> <version var> <repo> <name prefix> <arch suffix> <sha var>...
|
|
pin() {
|
|
local file=$1 vvar=$2 repo=$3 prefix=$4
|
|
shift 4
|
|
local ver
|
|
ver=$(sed -n "s/^ *$vvar: *\"\([0-9.]*\)\".*/\1/p" "$file")
|
|
[ -n "$ver" ] || {
|
|
echo "no $vvar in $file" >&2
|
|
exit 1
|
|
}
|
|
local base="https://github.com/$repo/releases/download/v$ver"
|
|
curl -fsSL --retry 3 -o "$work/sums" "$base/${prefix}_${ver}_checksums.txt"
|
|
while [ "$#" -gt 0 ]; do
|
|
local arch=$1 svar=$2
|
|
shift 2
|
|
local tgz="${prefix}_${ver}_${arch}.tar.gz"
|
|
curl -fsSL --retry 3 -o "$work/$tgz" "$base/$tgz"
|
|
local got want
|
|
got=$(sha256sum "$work/$tgz" | cut -d' ' -f1)
|
|
want=$(awk -v f="$tgz" '$2 == f {print $1}' "$work/sums")
|
|
[ "$got" = "$want" ] || {
|
|
echo "$tgz: downloaded $got, release says ${want:-nothing}" >&2
|
|
exit 1
|
|
}
|
|
sed -i "s/^\( *$svar: *\)[0-9a-f]\{64\}/\1$got/" "$file"
|
|
echo "$tgz $got"
|
|
done
|
|
}
|
|
|
|
pin trivy-gate/action.yml TRIVY_VERSION aquasecurity/trivy trivy \
|
|
Linux-64bit TRIVY_SHA256_AMD64 Linux-ARM64 TRIVY_SHA256_ARM64
|
|
pin gitleaks/action.yml GITLEAKS_VERSION gitleaks/gitleaks gitleaks \
|
|
linux_x64 GITLEAKS_SHA256_X64 linux_arm64 GITLEAKS_SHA256_ARM64
|