From e566f3a11dcd1973545e065d85fe9c3b1c345ddb Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:22:43 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20images:=20align=20image-bump?= =?UTF-8?q?=20commit=20author=20with=20sign-off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The squash of a bump PR is authored under the TOPUP_PUSH_TOKEN owner's primary email, but the commit was only signed off with the noreply identity, so the DCO app flagged it. Sign off for each distinct address. Closes #18697 Co-Authored-By: Claude Sonnet 5.5 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com> --- .github/workflows/cli-pin-bump.yml | 23 ++++++++- .../fixed-18697-image-bump-dco-signoff.md | 1 + src/scripts/cli-pin-signoff.sh | 30 ++++++++++++ src/scripts/test-cli-pin-signoff.sh | 49 +++++++++++++++++++ 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixed-18697-image-bump-dco-signoff.md create mode 100755 src/scripts/cli-pin-signoff.sh create mode 100755 src/scripts/test-cli-pin-signoff.sh diff --git a/.github/workflows/cli-pin-bump.yml b/.github/workflows/cli-pin-bump.yml index ccd98e1053..b445e0509f 100644 --- a/.github/workflows/cli-pin-bump.yml +++ b/.github/workflows/cli-pin-bump.yml @@ -64,6 +64,8 @@ on: - '.github/workflows/cli-pin-bump.yml' - 'src/scripts/cli-pin-bump.sh' - 'src/scripts/test-cli-pin-bump.sh' + - 'src/scripts/cli-pin-signoff.sh' + - 'src/scripts/test-cli-pin-signoff.sh' - 'src/scripts/check-cli-model-lists.sh' - 'src/scripts/test-check-cli-model-lists.sh' - 'src/scripts/cli-model-requirements.txt' @@ -95,6 +97,9 @@ jobs: bash -n src/scripts/test-cli-pin-bump.sh bash -n .github/scripts/check-bob-launch-flags.sh bash src/scripts/test-cli-pin-bump.sh + bash -n src/scripts/cli-pin-signoff.sh + bash -n src/scripts/test-cli-pin-signoff.sh + bash src/scripts/test-cli-pin-signoff.sh bash -n src/scripts/check-cli-model-lists.sh bash -n src/scripts/test-check-cli-model-lists.sh bash src/scripts/test-check-cli-model-lists.sh @@ -279,8 +284,22 @@ jobs: echo "::error::Could not resolve the TOPUP_PUSH_TOKEN owner; a PR it opens would squash to a mismatched-signoff (#11412)." exit 1 fi - git commit --amend --no-edit \ - --trailer "Signed-off-by: ${login} <${id}+${login}@users.noreply.github.com>" + # The squash is authored under the owner's PRIMARY email, which is + # not the noreply one, so the DCO app flagged every bump on the + # v5 -> v6 top-up (#18697). Sign off for each address GitHub may + # attribute (public profile email, then the primary from + # user/emails when the token may read it; best-effort). + emails=() + pub="$(GH_TOKEN="$PR_TOKEN" gh api user --jq '.email // empty' 2>/dev/null || true)" + [ -z "$pub" ] || emails+=("$pub") + while IFS= read -r em; do + [ -z "$em" ] || emails+=("$em") + done < <(GH_TOKEN="$PR_TOKEN" gh api user/emails --jq '.[] | select(.primary) | .email' 2>/dev/null || true) + args=() + while IFS= read -r t; do + [ -z "$t" ] || args+=(--trailer "$t") + done < <(bash src/scripts/cli-pin-signoff.sh "$login" "$id" "${emails[@]}") + git commit --amend --no-edit "${args[@]}" fi git push --force-with-lease origin "$HEAD_BRANCH" diff --git a/changelog.d/fixed-18697-image-bump-dco-signoff.md b/changelog.d/fixed-18697-image-bump-dco-signoff.md new file mode 100644 index 0000000000..77cdabb1f6 --- /dev/null +++ b/changelog.d/fixed-18697-image-bump-dco-signoff.md @@ -0,0 +1 @@ +- The CLI pin-bump workflow now signs its commit off for every email GitHub may attribute the squash to (the `TOPUP_PUSH_TOKEN` owner's public and primary addresses, not only the noreply one), so the DCO app no longer flags image-bump commits and blocks v5 -> v6 top-ups (#18697). diff --git a/src/scripts/cli-pin-signoff.sh b/src/scripts/cli-pin-signoff.sh new file mode 100755 index 0000000000..d864f129f9 --- /dev/null +++ b/src/scripts/cli-pin-signoff.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Prints the extra Signed-off-by trailers a cli-pin-bump commit needs so the +# probot DCO rule passes on the commit GitHub's squash writes (#18697). +# +# Usage: cli-pin-signoff.sh LOGIN ID [EMAIL...] +# +# The squash commit is authored as the PR opener (the TOPUP_PUSH_TOKEN owner), +# under whatever email GitHub attributes to them: their primary address, which +# is not the users.noreply.github.com one. The DCO app wants the AUTHOR email +# in a Signed-off-by, so emit one trailer per distinct email: the noreply +# identity first (always valid), then each real address supplied. Empty, +# "null" and malformed emails are skipped; duplicates are dropped. +set -euo pipefail + +login="${1:?login required}" +id="${2:?id required}" +shift 2 + +declare -A seen=() +emit() { + local email="${1,,}" + [ -n "$email" ] && [ "$email" != "null" ] || return 0 + [[ "$email" =~ ^[^[:space:]@\<\>]+@[^[:space:]@\<\>]+$ ]] || return 0 + [ -z "${seen[$email]:-}" ] || return 0 + seen[$email]=1 + printf 'Signed-off-by: %s <%s>\n' "$login" "$1" +} + +emit "${id}+${login}@users.noreply.github.com" +for e in "$@"; do emit "$e"; done diff --git a/src/scripts/test-cli-pin-signoff.sh b/src/scripts/test-cli-pin-signoff.sh new file mode 100755 index 0000000000..fef7a4d14b --- /dev/null +++ b/src/scripts/test-cli-pin-signoff.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Self-test for cli-pin-signoff.sh (#18697). No network. Builds a commit the way +# the bump workflow does (bot author + bot sign-off, then the extra trailers) +# and applies the probot DCO rule to the commit GitHub's squash would write: +# the author email must appear in some Signed-off-by trailer. +set -euo pipefail + +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT="$HERE/cli-pin-signoff.sh" +PASS=0; FAIL=0 +pass() { PASS=$((PASS+1)); echo " ok: $1"; } +fail() { FAIL=$((FAIL+1)); echo " FAIL: $1"; } + +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +# dco_ok AUTHOR_EMAIL MESSAGE: probot/dco's rule, case-insensitive. +dco_ok() { + printf '%s\n' "$2" | grep -iE '^Signed-off-by: .*<'"$1"'>[[:space:]]*$' >/dev/null +} + +build_msg() { + local login="$1" id="$2"; shift 2 + git init -q "$TMP/r" + ( + cd "$TMP/r" + GIT_AUTHOR_NAME="hive-release[bot]" GIT_AUTHOR_EMAIL="hive-release@hive.kubestellar.io" \ + GIT_COMMITTER_NAME="hive-release[bot]" GIT_COMMITTER_EMAIL="hive-release@hive.kubestellar.io" git \ + commit -q --allow-empty -s -m "images: bump x 1 -> 2" + trailers="$(bash "$SCRIPT" "$login" "$id" "$@")" + args=() + while IFS= read -r t; do [ -n "$t" ] && args+=(--trailer "$t"); done <<<"$trailers" + git commit -q --amend --allow-empty --no-edit "${args[@]}" + git log -1 --format=%B + ) + rm -rf "$TMP/r" +} + +msg="$(build_msg clubanderson 407614 andy@clubanderson.com null "" Andy@ClubAnderson.com)" +dco_ok 'andy@clubanderson\.com' "$msg" && pass "primary author email is signed off" || fail "primary author email missing" +dco_ok '407614\+clubanderson@users\.noreply\.github\.com' "$msg" && pass "noreply identity signed off" || fail "noreply missing" +dco_ok 'hive-release@hive\.kubestellar\.io' "$msg" && pass "bot sign-off kept" || fail "bot sign-off lost" +[ "$(grep -ic '^Signed-off-by: .*andy@clubanderson' <<<"$msg")" = 1 ] && pass "duplicate/null/empty emails dropped" || fail "duplicate trailer" + +msg="$(build_msg someone 5)" +if dco_ok 'andy@clubanderson\.com' "$msg"; then fail "unrelated author wrongly matched"; else pass "no email supplied -> only noreply (author without sign-off is still detected)"; fi + +echo "$PASS passed, $FAIL failed" +[ "$FAIL" = 0 ] From 24de7c1bdc7cb0b0c223d23c6b5ec33978b35566 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:46:09 -0500 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20test:=20export=20committer?= =?UTF-8?q?=20identity=20in=20cli-pin-signoff=20self-test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --amend step had no committer on CI runners (no global git identity). Co-Authored-By: Claude Sonnet 5.5 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/scripts/test-cli-pin-signoff.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scripts/test-cli-pin-signoff.sh b/src/scripts/test-cli-pin-signoff.sh index fef7a4d14b..62af4a489d 100755 --- a/src/scripts/test-cli-pin-signoff.sh +++ b/src/scripts/test-cli-pin-signoff.sh @@ -24,9 +24,11 @@ build_msg() { git init -q "$TMP/r" ( cd "$TMP/r" - GIT_AUTHOR_NAME="hive-release[bot]" GIT_AUTHOR_EMAIL="hive-release@hive.kubestellar.io" \ - GIT_COMMITTER_NAME="hive-release[bot]" GIT_COMMITTER_EMAIL="hive-release@hive.kubestellar.io" git \ - commit -q --allow-empty -s -m "images: bump x 1 -> 2" + # Exported so the --amend below has a committer too: CI runners have no + # global git identity. + export GIT_AUTHOR_NAME="hive-release[bot]" GIT_AUTHOR_EMAIL="hive-release@hive.kubestellar.io" + export GIT_COMMITTER_NAME="hive-release[bot]" GIT_COMMITTER_EMAIL="hive-release@hive.kubestellar.io" + git commit -q --allow-empty -s -m "images: bump x 1 -> 2" trailers="$(bash "$SCRIPT" "$login" "$id" "$@")" args=() while IFS= read -r t; do [ -n "$t" ] && args+=(--trailer "$t"); done <<<"$trailers" From 83eed245e2141104395b113708f76b2f07692cc4 Mon Sep 17 00:00:00 2001 From: "hivecommons-hive[bot]" Date: Tue, 17 Nov 2026 11:33:28 -0500 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=8C=B1=20re-pin=20TRUSTED=5FSCRIPTS?= =?UTF-8?q?=5FTREE=20for=20the=20new=20cli-pin-signoff=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hivecommons-hive[bot] --- .github/scripts/integration-governance.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 2b3a06934f..8c5cedc075 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '78d89054cc569554b1066b2eb2e322a7f38c285a'; +const TRUSTED_SCRIPTS_TREE = '8e79075d0e3308ce6ab26960c1749c04bbf924af'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) =>