Repository navigation
fix(gate): pass a non-required check red on the base head too - #1052
Merged
Merged
Conversation
…se head too A red devctl run is judged against its base branch: every red check that the base does not require, is no security scan, and is red on the base head too is accepted, and devctl runs again with --accept-red for each. A check green, running or without a result on the base head, a required check and a security scan refuse as before; a devctl without the flag ends the run red, the gate's line naming why.
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.
Problem
devctl pr mergeis red (exit 1) on any failed check, and the gate passed that on: a check the base branch does not require, red on the base branch's head for a known reason, refused every unrelated pull request, a docs-only one included (#1048).Change
The gate judges a red run against its base branch (
merge.JudgeRed, the base read bygithub.ReadBaseCheckswithgh api: the branch's protection and rulesets for the required contexts, its head's check runs and statuses):When every red check is let through, devctl runs again with
--accept-red <check>for each (eventmerge.acceptred, naming the check and why), and the caller reads that run's document alone. Otherwise the run ends red as before, and the gate's line names the judgement. The red document is held off stdout until it is judged.--accept-redis giantswarm/devctl#2692. The gate checks for the flag indevctl pr merge --help. Until the installed devctl has it, the gate keeps today's behaviour, and its line says the merge waits for a devctl release with the flag.Proof
internal/merge/red_test.go): non-required red on both heads (let through), non-required red on the PR only (refuse), required red (by the document or by the base's protection: refuse), security scan red on both heads (refuse), base result missing (refuse), base still running (refuse), a mix (refuse, naming both), a red CircleCI workflow (refuse).cmd/gateacceptred_test.go): a run red only on a base-red check is run again with--accept-red e2e-testand merges, and the caller reads one document. A check green or missing on the base, or a devctl without the flag, ends red after one run.internal/github/basechecks_test.go: required contexts from protection and rulesets; newest check run per name; statuses.go test -p 2 ./....fork-ledger). It read thegiantswarmbranch's required contexts live (fork-ledger,govulncheck,run-tests,semantic-pull-request / Validate PR title) and refused (fork-ledger refuses: required by giantswarm). No open pull request had a non-required check red on both heads at the time, so the unit tests prove that case.Acceptance criteria
--accept-red).