ci(gate-only): chain the push gate off Unit Tests instead of re-running it - #731
Conversation
ec728aa to
40097d5
Compare
…ng it deploy-pages, cron-vendor and cron-conda each called unit-tests.yml with gate-only: true on push to main, re-running its single-version "Gate" job against a commit Unit Tests' own push trigger had already tested in full. Measured on run 35890190308 (the issue's own "quiet queue" push): the three in-scope Gate jobs ran 25m15s, 29m34s and 18m50s -- ~74 min of duplicate execution on that one push alone. Replace their push trigger with workflow_run on Unit Tests' completion, gated per job on conclusion == success, event == push and head_branch == main -- workflow_run also fires for a pull request's Unit Tests run, and without this a green PR would deploy docs, push a vendor commit or upload a conda build from that PR's tree. Checkout stays on the default github.sha (main's tip) rather than pinning workflow_run.head_sha: CodeQL flagged the latter as checkout of untrusted code in a privileged context, since that field is a fork's commit on a PR-derived workflow_run. All three jobs want main's current tip anyway, and vendor/conda both rebase onto it before pushing regardless. Also routed conda-tag's PCAPKIT_VERSION/PCAPKIT_BUILD through env: rather than splicing them into the script text, closing the code-injection CodeQL flagged there -- that statement pre-existed, but workflow_run is what made it reachable. Each workflow's schedule trigger keeps its own gate-only call unchanged. create-release.yml's gate-only caller is untouched: it fires on tag pushes and Vendor Update's completion, not on every push to main. Part of #715. No code path changed; no coverage delta.
40097d5 to
e0f023d
Compare
|
✅ GOOD TO MERGE @ |
|
✅ GOOD TO MERGE @ Method: read/traced only — I cannot execute Actions. All three YAMLs parse (PyYAML 6.0.3);
Saving, derived independently: ~60–84 min of ubuntu runner time per fully-executed Non-blocking notes:
✅ GOOD TO MERGE @ |
make pylint,make mypy,make isort) -- N/A, no Python changedmake testpasses, and a test case covers the change -- forbidden the full suite; ranyaml.safe_loadon all three files andactionlintinstead (clean; only pre-existing shellcheck notes on untouched lines)What is the purpose of your pull request?
ci— workflows or build toolingDescription
Part of #715. Item 2:
deploy-pages,cron-vendorandcron-condaeach calledunit-tests.ymlwith
gate-only: trueonpush: [main], re-running the single-version Gate job against a commitUnit Tests' push trigger had already tested in full. Measured on run35890190308(the issue'sown cited "quiet queue" push): the three Gate jobs took 25m15s, 29m34s, 18m50s -- ~74 of a real
~99 min of duplicate Gate execution that push (
create-release.yml's own Gate chains offVendor Updatealready and is out of scope).Replaced their
pushtrigger withworkflow_runonUnit Testscompletion, gated per job onconclusion == 'success' && event == 'push' && head_branch == 'main', sinceworkflow_runalsofires for a pull request's
Unit Testsrun.scheduletriggers keep their own gate.CodeQL findings and how they were resolved (owner ruling: fix structurally, no false-positive
argument): checking out
github.event.workflow_run.head_shawas flagged as "checkout of untrustedcode in a privileged context" on all three files, since that field is a fork's commit on a
PR-triggered
workflow_run. Fixed by checking out the defaultgithub.sha(main's tip) instead --all three jobs want main's current tip anyway, and vendor/conda rebase onto it before pushing
regardless. Two "Code injection" alerts on
conda-tag's tag/push steps (splicingneeds.conda-update.outputs.*intorun:text) are fixed viaenv:+ shell variables. Those twostatements pre-date this PR; the alerts do not --
main'scron-conda.ymlhad noattacker-reachable trigger for CodeQL's model until
workflow_runintroduced one, so "pre-existing"would understate what changed. Also hardened:
cron-vendor.ymlgets a default-deny top-levelpermissions: {}(it had none), and both maintenance checkouts getpersist-credentials: false.Job-count/duplicate-execution savings are unaffected by the
head_sha->github.shachange: thatsaving is entirely from removing the three re-run Gate jobs, unrelated to which ref the downstream
job later checks out.
No Python changed; no coverage delta.