fj run watch/view --exit-status to gate CI on run conclusion #135
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task
Add
--exit-statustofj run watchandfj run view: when set, exit non-zero if the run's terminal conclusion is anything butsuccess/skipped. Default stays0so existing piping is unaffected.view.state.run.status), not just the watched job 0, so a failure in job 1 is not reported as success. This mirrors the existing--log-failed"don't hide a failure behind a green job 0" reasoning atsrc/cli/workflow_run.rs:160.docs/gh-to-fj.md:109to mapgh run watch --exit-status->fj run watch --exit-status.Source: rasterstate/fj#125.
Priority
p1. "Kick a workflow and gate the pipeline on green" is the core CI primitive:
fj run watch "$RUN" --exit-status || exit 1. Today that|| exit 1is dead code, sincewatchreturnsOk(())on a failed run and the process exits0, so the deploy proceeds on red. That is a silent correctness trap, not just a missing convenience, which is what makes it a blocker.Reason
watchdeclares the run finished and returnsOk(())regardless of conclusion (src/cli/workflow_run.rs:410);viewlikewise prints the summary and returnsOk(())(:261-278). The process exit path returns1only onErr(src/main.rs:62-63), so a red run is indistinguishable from a green one to a script. The only workaround isfj run view N --jsonplus grepping.status/.jobs[].status, exactly the brittle scripting the--jsonwork set out to remove.Acceptance
fj run watch <run> --exit-statusexits non-zero when the run's terminal conclusion is notsuccess/skipped.fj run view <run> --exit-statusdoes the same over already-fetched data.0on a finished run, preserving current piping.docs/gh-to-fj.mdrecords the flag.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --allpass.Dependencies
None directly. Distinct from rasterstate/fj#123 (failed API calls); this is a successful command observing a failed run. Pairs with rasterstate/fj#129 to make "trigger + gate" work end to end.
Size
S