Skip to content

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.

  1. TRUSS reads the flow file and checks it. A mistake stops the run before anything starts.
  2. It collects the secrets the flow names. A missing secret stops the run before any step starts.
  3. It starts steps in order. A step starts when every step it needs has succeeded and a slot is free (flow.concurrency). Steps of a job run one after another.
  4. Each step is one command for your system’s shell (sh -c on Linux and macOS, cmd /C on Windows). Steps that do not wait for each other run side by side.
  5. 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.

  • The first failure that is not continue-on-error stops the run: running steps are stopped, and nothing new starts. The exceptions are steps with if: failure() or if: 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.

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 after kill_timeout (default 10 seconds, at most one minute) gets SIGKILL. A second Ctrl-C during truss run kills at once.
  • Windows: the step and everything it started end at once.

A step sees variables from these layers. A later layer wins over an earlier one:

  1. the environment TRUSS started in (your shell, or the daemon’s),
  2. the built-in variables (TRUSS_FLOW, TRUSS_STEP, …),
  3. env in truss.yaml (the project),
  4. env of the flow,
  5. env of the job,
  6. env of the step,
  7. --env NAME=VALUE on truss run,
  8. the step’s secrets, from the secret store (--env cannot replace a secret).

${NAME} in a value is replaced when the step starts, from the layers below it.

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

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.