Skip to content

Commit bb1c170

Browse files
committed
docs: ci: Update error handling
About merging err and fail into one for individual step failure. Signed-off-by: Jorge Marques <[email protected]>
1 parent 78e2dfb commit bb1c170

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

docs/ci.rst

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,38 @@ Warning and error handling
6565
Each tool will have its own outputs and the standard to consider something
6666
an error, a warning or something else.
6767
So the workflows separate the steps outputs into steps events named
68-
``err``, ``fail``, and ``warn``:
69-
70-
* ``err``: What a method that must succeed returns, if not captured
71-
(``|| true``), fails the CI. Internal to the bash methods, return codes
72-
expected to return known warnings and errors are filtered-out, deferring
73-
to the assertion step.
74-
* ``fail``: Indicates that a warning or error deemed strict was raised.
75-
Is collected at the assert job and ends the run with failure.
68+
``fail``, and ``warn``:
69+
70+
* ``fail``: Indicates that a warning or error deemed strict was raised, and
71+
or what the method that must succeed returns. Will fail the step if not
72+
captured (``|| true``). The CI allows some steps to fail, in order to
73+
collect all failures and assert the job at the end.
7674
* ``warn``: Indicates that a warning or error non-deemed strict was raised.
7775
Is collected at the assert job and **does not** end the run with failure.
7876

77+
When ``continue-on-error: true`` is used at the job level, the following
78+
topology rules must be followed based on the immediate downstream step:
79+
80+
* If downstream is an assert job, the ci already fails on ``step_fail_*``, so a
81+
``failure()`` step should just set ``set_step_fail "assert_state"``, as well
82+
the job-scoped ``fatal=true`` environment variable.
83+
* If downstream is an regular job, the job must export an ``fail=$fail`` output,
84+
to be used alongside the ``needs`` rule, for example:
85+
86+
.. code:: yaml
87+
88+
build_gcc_aarch64:
89+
needs: [checks]
90+
if: needs.checks.outputs.fatal != 'true'
91+
92+
These rules ensure that the downstream jobs do not run on fatal errors.
93+
Optional steps may also set ``fatal`` job-scoped environment variable, if taking
94+
care of calling ``set_step_fail``.
95+
96+
The draw back of this approach is that captured/unexpected errors may have a step
97+
exit with error without set the set_step_fail, causing the step fail to fail through
98+
and passing the immediate assert step.
99+
79100
Checking steps description
80101
~~~~~~~~~~~~~~~~~~~~~~~~~~
81102

0 commit comments

Comments
 (0)