Repository navigation
ci: make the required build checks fail closed - #106
borisr-code-ibm wants to merge 2 commits into
Conversation
rules-main requires "Agent build & test" and "ChatApp build & test". Those were the build jobs themselves, which the changes job skips when a PR touches no project files. GitHub counts a skipped required check as passing, so the check also passed whenever change detection went wrong, and a PR that does not compile could be merged: a failing git diff wrote run_ci=false, a failed or cancelled changes job skipped the build, a file moved out of a project only showed its new path, and paths that git quotes missed the ^agent/ and ^ChatApp/ patterns. Give the required names to small gate jobs that always run and pass only when the build succeeded, or was skipped because detection found no project changes. Detection stores git diff --no-renames output in a variable first, so a git error fails the step, and its patterns accept git's quoted paths. The build jobs keep their steps under new names.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
ChatApp CI fails in a test that predates this PR. It runs here only because this PR edits
I'll send a separate PR that makes the test wait for the function to be indexed and for the toggle to finish. Once it's merged, I'll update this branch so CI can run again. |
What I have done and why
rules-mainrequires the checks Agent build & test and ChatApp build & test (#99). They were the build jobs themselves, which thechangesjob skips when a PR doesn't touch the project. GitHub counts a skipped required check as passing (docs; #101 and #102 merged with both checks skipped). So the check also passed whenever change detection went wrong, and a PR that doesn't compile could be merged:main)agent/agent/files changedgit difffails in Check changes (e.g. noorigin/<base>or no merge base)run_ci=false, build skipped, check passesagent/agent/…/Über.kt,a"b.kt)"agent/…misses^agent/, build skipped, check passesThe same applies to ChatApp.
Changes, in both
agent.yamlandchatapp.yaml:rules-mainneeds no change. It runs withif: always()and haspermissions: {}. It passes only whenchangessucceeded and the build either passed or was skipped because the PR touches no project files. A failed or cancelled run, a missing output or an unexpected skip all fail the check.changesstoresgit diff --no-renames --name-onlyin a variable first, so a git error fails the step under the defaultbash -eshell. Its patterns also accept git's quoted path form (^"?).Testing
main, nothing new.bash -e, as the runner does: 136/136 cases pass.changesresult ×run_ci× build result (96).",\or a tab, empty diffs, push events, and a missing base ref (40).main's scripts, the same cases reproduce the four fail-open rows marked in the table.Notes for maintainers
rules-mainhasstrict_required_status_checks_policy: false, so two PRs that each pass CI can still breakmaintogether. Changing a PR's base doesn't re-run CI either. Requiring up-to-date branches (or a merge queue, which would also need amerge_grouptrigger) would cover both.main; Show dynamic and disabled function states in the Debug tab and fix flaky agent tests #104 addresses that.