test(release): cover the auto-promote resolve decision logic - #415
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.github/scripts/auto-promote-resolve.sh, a verbatim copy of the original inline logic.internal/release/autopromote_resolve_test.goexecs 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).