Skip to content

Expressions

Three step fields take an Argo expression: Only run this when… (when), List to repeat over (withParam) and Wait for… (depends).

Dagweave checks them as you type, on every plan, and says what’s wrong under the field: “The step ‘fetch’ has no output called ‘rows’. Its outputs are: count.”

Write To get
{{workflow.parameters.env}} A workflow parameter
{{tasks.fetch.outputs.result}} What the step fetch printed
{{tasks.fetch.outputs.parameters.count}} An output the step fetch declares
{{tasks.fetch.status}} How fetch ended, such as Succeeded
{{item}}, {{item.name}} The current item, on a step that repeats
{{workflow.name}}, {{workflow.namespace}} Details of the run itself

You can only read outputs of steps that finish first, so connect them on the canvas.

{{...}} is replaced with the value and Argo compares the text, so {{tasks.flip.outputs.result}} == heads needs no quotes. Quote values that might have spaces.

{{=...}} uses Argo’s expression language for sums, JSON and functions:

  • {{=asInt(tasks.fetch.outputs.result) > 10}} compares as a number.
  • {{=jsonpath(workflow.parameters.config, '$.region') == 'eu'}} reads a JSON field.
  • {{=sprig.default('dev', workflow.parameters.env) == 'prod'}} falls back to a default when empty.

Inside {{=...}}, write a dashed step name as tasks['build-image'].

Sprig functions Argo supports lists every Sprig function, Argo function and expr-lang builtin you can call, with what each one does, its signature and a working example.

A step waits until every connected step has succeeded or been skipped. To wait on something else, name it: fetch.Failed, fetch.Succeeded || fetch.Skipped, or !build.Errored. The results are Succeeded, Failed, Errored, Skipped, Omitted, Daemoned, AnySucceeded and AllFailed. Mention every connected step, and no others.

On Starter and above, press Builder beside a field. You get:

  • suggestions for parameters, earlier outputs, loop fields, workflow values and Argo’s functions
  • snippets for common patterns, such as “succeeded or skipped” or a JSON path
  • the exact line that goes in the YAML
  • Try it, which evaluates the expression for sample values and shows the result and its type. If the workflow has run before, you can load that run’s real parameters and outputs.

Try it runs on Dagweave, not your cluster. It won’t run functions that generate keys or passwords, random values, repeat or getHostByName. Argo still will.

From a terminal, dagweave expr in Dagweave Local does the same for free.