fix(release): repair tag gate and sibling-container publication (#1)

The release workflow could not complete on the self-hosted sibling-container
runner. Four defects are corrected together because three of them share the
same release.yml plumbing.

Exclude the tag under release from the prior-tag probe. check-release-tag.sh
already requires the tag to point at HEAD, so the unfiltered listing always
matched itself and rejected every first release before the initial baseline
branch could run.

Resolve host bind sources once per job. Steps run inside the runner container
while docker run starts siblings on the host daemon, so GITHUB_WORKSPACE and
RUNNER_TEMP are not usable as bind sources. A new step maps both to host paths
through the runner's own mounts and exports them; the build, provenance, smoke,
finalize, and publish steps reuse them, and publish-release.sh receives them by
environment instead of repeating the inspection. Bind destinations stay at the
container-internal paths so runner-side reads keep working unchanged.

Prove the signing material before the first push. Gitea package versions are
immutable, so a missing or undecryptable cosign key must abort ahead of the
require_absent gate rather than after packages and the image are published.

Authenticate the pinned consumer fetches. Both consumer repositories are
private, so anonymous fetches fail; the release token is passed to the
verification step and applied as a URL-scoped extra header through git's
config environment, keeping it out of argv, remotes, and on-disk config.
Anonymous fetch remains the fallback for local runs.
This commit is contained in:
KyuubiYoru
2026-08-22 19:47:57 +02:00
parent 589f802e2e
commit d41fa0c7e9
3 changed files with 87 additions and 13 deletions
+18 -2
View File
@@ -10,6 +10,12 @@ image="$registry/heikyu/rendezvous:$version"
token="${RENDEZVOUS_RELEASE_TOKEN:?RENDEZVOUS_RELEASE_TOKEN is required}"
username="${RENDEZVOUS_RELEASE_USERNAME:?RENDEZVOUS_RELEASE_USERNAME is required}"
release_builder="${RENDEZVOUS_RELEASE_BUILDER:?RENDEZVOUS_RELEASE_BUILDER is required}"
# Sibling-container runners execute this script inside a container while
# `docker run` starts containers on the host daemon, so bind sources must be
# host paths. The workflow resolves them once and exports them; a direct host
# run keeps the local paths.
workspace_source="${RENDEZVOUS_WORKSPACE_SOURCE:-$root}"
release_dir_source="${RENDEZVOUS_RELEASE_DIR_SOURCE:-$release_dir}"
docker_config="$(mktemp -d)"
curl_config="$(mktemp)"
release_request=""
@@ -33,11 +39,21 @@ for command in cosign curl docker dotnet jq; do
}
done
# Publication is a one-way gate: Gitea package versions are immutable, so the
# signing material must be proven usable before anything is pushed. Never print
# the key or the probe output.
: "${COSIGN_PRIVATE_KEY:?COSIGN_PRIVATE_KEY is required}"
: "${COSIGN_PASSWORD:?COSIGN_PASSWORD is required}"
cosign public-key --key env://COSIGN_PRIVATE_KEY >/dev/null || {
echo "Configured cosign key could not be loaded; refusing to publish." >&2
exit 1
}
run_release_builder() {
docker run --rm \
--user "$(id -u):$(id -g)" \
--volume "$root:/source:ro" \
--volume "$release_dir:$release_dir" \
--volume "$workspace_source:/source:ro" \
--volume "$release_dir_source:$release_dir" \
--workdir /source \
"$release_builder" "$@"
}
+20 -1
View File
@@ -5,6 +5,11 @@ root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version="${1:?usage: verify-real-consumers.sh VERSION RELEASE_DIRECTORY}"
release_dir="${2:?usage: verify-real-consumers.sh VERSION RELEASE_DIRECTORY}"
manifest="$root/eng/consumer-revisions.json"
# The pinned consumers live in private repositories, so release automation must
# authenticate. Keep the token in the environment git reads config from: it must
# never reach argv, the remote URL, or on-disk repository configuration.
token="${RENDEZVOUS_CONSUMER_TOKEN:-${RENDEZVOUS_RELEASE_TOKEN:-}}"
export GIT_TERMINAL_PROMPT=0
work="$(mktemp -d "${TMPDIR:-/tmp}/rendezvous-consumers.XXXXXX")"
cleanup() {
rm -rf "$work"
@@ -18,6 +23,20 @@ for command in dotnet git jq python3; do
}
done
fetch_consumer_revision() {
local checkout="$1"
local repository="$2"
local revision="$3"
if [[ -z "$token" ]]; then
git -C "$checkout" fetch --quiet --depth 1 origin "$revision"
return
fi
GIT_CONFIG_COUNT=1 \
GIT_CONFIG_KEY_0="http.${repository}.extraHeader" \
GIT_CONFIG_VALUE_0="Authorization: token ${token}" \
git -C "$checkout" fetch --quiet --depth 1 origin "$revision"
}
python3 "$root/eng/release_artifacts.py" consumer-config \
--local-source "$release_dir" \
--output "$work/NuGet.config"
@@ -31,7 +50,7 @@ for ((index = 0; index < count; index++)); do
checkout="$work/$name"
git -c init.defaultBranch=main init --quiet "$checkout"
git -C "$checkout" remote add origin "$repository"
git -C "$checkout" fetch --quiet --depth 1 origin "$revision"
fetch_consumer_revision "$checkout" "$repository" "$revision"
GIT_LFS_SKIP_SMUDGE=1 git -C "$checkout" checkout --quiet --detach FETCH_HEAD
[[ "$(git -C "$checkout" rev-parse HEAD)" == "$revision" ]] || {
echo "$name did not resolve the pinned consumer revision." >&2