Skip to content

test(release): cover the auto-promote resolve decision logic - #415

Merged
joshua-temple merged 2 commits into
mainfrom
test/auto-promote-resolve
Jun 29, 2026
Merged

joshua-temple merged 2 commits into
mainfrom
test/auto-promote-resolve

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

What

Closes feature-coverage gap #5 (#412). The auto-promote promote/no-promote decision was pure inline shell in auto-promote.yaml with no test - the only validation was a real release.

How

  • Extracts the decision core (conclusion gate, full_run gate, rc-only gate, -rc.N suffix strip) into .github/scripts/auto-promote-resolve.sh, a verbatim copy of the original inline logic.
  • auto-promote.yaml's resolve job now runs the script, passing CONCLUSION / WR_HEAD_BRANCH / WR_HEAD_SHA / GH_TOKEN via env (untrusted fields read quoted inside the script, never interpolated).
  • internal/release/autopromote_resolve_test.go execs the script in isolated temp dirs and asserts $GITHUB_OUTPUT.

Behavior unchanged

The script is the original step's logic verbatim (same gates, notices, fallback, strip); the only structural change is where it lives plus a sparse-checkout step. The one added line (a defensive conclusion gate) is inert because the job already runs only on success. Verified all six paths produce identical $GITHUB_OUTPUT to the prior inline body.

Test cases (9 subtests, all pass)

rc+full+success -> promote vX.Y.Z; -dryrun -> no promote; selective/full_run=false -> no promote; failure -> no promote; v1.20.3-rc.10 -> v1.20.3 (multi-digit, no mangling); head_branch fallbacks; missing full-run.txt defaults to full run.

Verification

go build/test (2062 pass), golangci-lint, actionlint (auto-promote.yaml), shellcheck (the new script) all clean.

Part of the feature-coverage goal (#412).

Move the resolve job's promote/no-promote decision (conclusion gate,
full_run gate, rc-only gate, and -rc.N suffix strip) out of the inline
workflow shell into .github/scripts/auto-promote-resolve.sh so it can be
exercised in isolation. The resolve job sparse-checks-out the script and
calls it; untrusted workflow_run fields still flow through env vars and
are read quoted inside the script, never interpolated into a shell.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Exercise the auto-promote decision script with mock marker files and
workflow_run env across every gate: an rc tag on a full green run
promotes the suffix-stripped version, a dryrun version and a selective
run are gated out, a non-success conclusion never promotes, multi-digit
versions strip cleanly, and the head_branch fallback resolves the rc
when no artifact is present.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple enabled auto-merge (squash) June 29, 2026 15:27
@joshua-temple
joshua-temple merged commit efcc181 into main Jun 29, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant