Skip to main content
In this lesson you’ll learn how to use the when condition in Argo Workflows to run steps conditionally based on workflow parameters or the outputs of other steps. Conditional execution helps you skip unnecessary work (for example, skipping tests for production-only runs) and keep your pipelines efficient. Overview
  • The workflow below uses a main entrypoint with three sequential steps: build, test, and deploy.
  • The test step contains a when expression that only allows it to run when the environment parameter is not production.
  • The environment parameter is declared at the workflow level and defaults to "production".
Complete workflow example
How it works
  • The when expression on the test step evaluates the value of {{workflow.parameters.environment}}.
  • With the default value "production", the expression production != production evaluates to false; therefore the test step is skipped.
  • When a when condition evaluates to false the UI and logs show the step as “skipped” and provide the evaluation result.
Example UI evaluation output:
Override the parameter to run the test step
  • In the Argo Workflows web UI you can resubmit a workflow and change parameters in the resubmit panel before clicking RESUBMIT.
  • From the CLI you can override parameters when submitting a workflow. Example:
This causes the when expression to evaluate as test != production (true), so the test step will execute alongside build and deploy.
A screenshot of the Argo Workflows web UI showing a workflow diagram (with deploy, test, build nodes) on the left and a "Resubmit Workflow" side panel on the right where parameters (environment = test) can be overridden and a "+ RESUBMIT" button is shown.
Result after resubmission
  • After resubmitting with environment set to a non-production value (for example, test), the when expression evaluates to true.
  • The workflow graph then shows all three steps (build, test, deploy) as completed.
A screenshot of the Argo Workflows web UI showing a workflow graph with three completed steps labeled "deploy", "test", and "build." The right-hand panel displays summary details for the selected pod, including name, host node, phase (Succeeded), start/end times, and duration.
Quick reference: behavior by environment value Best practices and tips
Use when to make pipelines declarative and efficient: reference workflow parameters and the outputs of previous steps to implement conditional logic. Expressions must evaluate to a boolean-like result (true/false). For more details, see the Argo Workflows documentation: Argo Workflows – Conditional Execution.
Common pitfalls
Be careful with quoting and whitespace in when expressions. If your parameter values contain spaces or special characters, quote them appropriately in the expression or ensure values are pre-normalized to avoid unexpected evaluation results.
That’s how you use the when condition in Argo Workflows to control step execution based on parameters or outputs.

Watch Video