How a run works
What happens between truss run build (or a schedule firing) and the last line of the log. Read
this when a flow behaves in a way you did not expect.
The steps of a run
Section titled “The steps of a run”- TRUSS reads the flow file and checks it. A mistake stops the run before anything starts.
- It collects the secrets the flow names. A missing secret stops the run before any step starts.
- It starts steps in order. A step starts when every step it
needshas succeeded and a slot is free (flow.concurrency). Steps of a job run one after another. - Each step is one command for your system’s shell (
sh -con Linux and macOS,cmd /Con Windows). Steps that do not wait for each other run side by side. - The run ends when every step has finished, or the first failure stops it. TRUSS writes the summary and the exit code.
A step is a new shell every time. A cd or an export in one step does not reach the next. Share
values through env, or through a file in $TRUSS_TEMP_DIR
(Variables and secrets).
When a step ends, everything it started in the background ends with it.
When a step fails
Section titled “When a step fails”- The first failure that is not
continue-on-errorstops the run: running steps are stopped, and nothing new starts. The exceptions are steps withif: failure()orif: always(). - A step can be tried again (
retries,retry_delay). Its result is its last attempt. - A stopped step counts as failed, even if it exits
0.
See When something fails.
How a step is stopped
Section titled “How a step is stopped”A step is stopped when its timeout passes, when you cancel the run (Ctrl-C, truss cancel), when
another step fails, or when the daemon stops.
- Linux and macOS: every process of the step gets
SIGTERM, so a script can clean up. What still runs afterkill_timeout(default 10 seconds, at most one minute) getsSIGKILL. A second Ctrl-C duringtruss runkills at once. - Windows: the step and everything it started end at once.
The environment of a step
Section titled “The environment of a step”A step sees variables from these layers. A later layer wins over an earlier one:
- the environment TRUSS started in (your shell, or the daemon’s),
- the built-in variables (
TRUSS_FLOW,TRUSS_STEP, …), envintruss.yaml(the project),envof the flow,envof the job,envof the step,--env NAME=VALUEontruss run,- the step’s
secrets, from the secret store (--envcannot replace a secret).
${NAME} in a value is replaced when the step starts, from the layers below it.
Where things are kept
Section titled “Where things are kept”| What | Where |
|---|---|
The log of a truss run |
.truss/state/<flow>/run.log in the project |
A folder that stays between runs (TRUSS_DATA_DIR) |
.truss/state/<flow>/data/ for truss run; ~/.truss/pipelines/<flow>/ for the daemon |
A folder for one run (TRUSS_TEMP_DIR) |
The system’s temporary folder. Removed when the run ends. |
| Runs of the daemon, with their logs and history | ~/.truss/runs/ |
| Secrets | ~/.truss/secrets.json |
| The daemon’s settings | ~/.truss/config.yaml |
Run by hand or by the daemon
Section titled “Run by hand or by the daemon”truss run and the daemon run flows the same way, so a flow behaves the same in both. The
differences:
truss run |
The daemon | |
|---|---|---|
| Started by | you, in your terminal | a schedule, a hook, truss trigger or Desktop |
| Starts with the environment of | your shell | the daemon, which can have a shorter PATH |
| History | the last log of each flow, in the project | every run, in ~/.truss/runs/ |
Shown in truss runs and Desktop |
only with --track |
always |
See the daemon.