Skip to content

Exit codes

Every rk command ends with an exit code a script or CI job can act on.

CodeMeaning
0Pass. The run completed and the verdict is pass.
1Fail. The run completed and a check or the verdict failed.
2Usage. A bad flag or argument, a missing required flag, or an -output-file that can't be written. Nothing ran.
3Unsupported. The flow reached a state its template declares as "the target doesn't support this". An answer, not a failure.
4Infrastructure. The run couldn't happen or finish: a config, template or subscriber file that doesn't load, a transport that doesn't come up, a port that can't be bound, an errored run.
5Licence. The licence can't be read, or it doesn't allow what the run needs. Nothing ran.
6rk report hosts only: a host's CPU steal over the whole run was above -max-cell-steal: the host, not the core, disturbed the measurement.

How the code is decided

  • run-flow:

    • 0 when the verdict is pass;
    • 3 when it's unsupported;
    • 1 for any other completed run;
    • 4 when the run errored. An oracle failure in a fuzz run is 1.
  • run-suite:

    • the worst outcome over its steps (pass 0, unsupported 3, otherwise 1);
    • 4 when a cycle errored without a graded failure, or when nothing ran.
  • fuzz:

    • 1 if any target failed;
    • otherwise the first errored target's code (2, 4 or 5);
    • otherwise 3 if no target passed;
    • otherwise 0.
  • check: 1 if a probe failed, 4 if the config doesn't load or there's nothing to probe.
  • server uspace and server dpdk: 2 when -protocol is missing or isn't icmp, udp or tcp; 5 when the licence doesn't grant what they need (datapath.dpdk for dpdk, obs.prometheus for -metrics-port); 4 when a port can't be bound or the datapath doesn't start. server dpdk then ends with its verdict: 0 pass, 1 fail.
  • lint: 0 valid, 1 invalid.

Exceptions

A few commands differ from the table:

  • rk validate: exits 1 when the licence denies the flow.
  • rk describe: exits 1 when it can't read the flow file.

The report on failure

With -output json or -output junit, rk writes a report even when it stops before running. That includes a usage error found while parsing flags:

JSON

In JUnit it's a single test case with <error type="exit_N">.