Argo Workflows Conditional Quick Fix - When Expression Errors
DodaTech
Updated 2026-06-26
1 min read
Argo Workflows conditionals control whether steps execute based on runtime values. Incorrect when syntax causes unexpected step execution or skipping. This guide covers the fix.
Quick Fix
Wrong
- name: deploy
template: deploy-app
when: "{{workflow.parameters.branch}} == main"
The issue: when expression is missing quotes around the string comparison, and the parameter reference uses workflow-level syntax incorrectly. The expression evaluates to false or throws an error.
Right
- name: deploy
template: deploy-app
when: "{{workflow.parameters.branch}} == 'main'"
arguments:
parameters:
- name: branch
value: "{{workflow.parameters.branch}}"
# Expected output after applying the fix
# When branch == 'main': deploy step executes
# When branch != 'main': deploy step skipped
# Status: Succeeded (or Skipped for deploy)
# Conditional logic works correctly
Prevention
- Always quote string values in
whenexpressions with single quotes - Use
==for equality,!=for inequality in when expressions - Reference parameters with proper
{{workflow.parameters.*}}syntax - Combine conditions with
&&(AND) and||(OR) operators - Test conditional expressions with
argo template lint
DodaTech Tools
Doda Browser's condition evaluator tests when expressions against sample parameter values. DodaZIP archives conditional branching decisions for audit. Durga Antivirus Pro validates condition expressions against injection.
FAQ
← Previous
Argo Workflows Artifact Quick Fix - Artifact Passing Errors
Next →
Argo Controller Config Quick Fix - Workflow Controller Setup
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro