Conditional (when) gate
Echoes a value only when a condition input is truthy, and is skipped otherwise.
Install v1.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/conditional-when/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/conditional-when/1.0.0/template.yaml
Facts
- Category
- Approval
- Tags
- approval busybox
- Entrypoint
guard- Template SHA-256
93aa70a4320f122479f44eafa2188ab3c5e3296210f16f7f2c06997eb1ef9fd8- Source
- conditional-when at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
busybox | 1.38.0 | sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4 |
Parameters
| Name | Description | Default |
|---|---|---|
condition required |
Truthy gate. The guarded step runs only when this equals "true". Example true |
none |
value |
Value echoed by the guarded step when it runs. | empty |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: conditional-when
labels:
dagweave.io/catalog-item: conditional-when
annotations:
# The catalog semver this manifest was authored at. The dagweave app records
# (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
# cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "Approval"
spec:
entrypoint: guard
templates:
# A reusable guard: the inner step runs (and emits `value`) only when `condition`
# is truthy. When the condition is false the step is skipped, demonstrating a
# reusable `when`-guarded building block other workflows compose.
- name: guard
inputs:
parameters:
# Truthy gate. The step runs only when this equals the string "true".
- name: condition
# Value echoed by the guarded step when it runs.
- name: value
default: ""
steps:
- - name: run
template: emit
# Argo substitutes the parameter, then evaluates the expression. With
# condition="true" this is `true == true` (runs); anything else skips.
when: "{{inputs.parameters.condition}} == true"
arguments:
parameters:
- name: value
value: "{{inputs.parameters.value}}"
# The guarded action: echo the value. A minimal no-op stand-in for whatever real
# work a composing workflow guards behind the condition.
- name: emit
inputs:
parameters:
- name: value
container:
# Pinned by digest per the catalog convention: an image rebuild can never
# silently change the behaviour of an already-released item version.
# busybox:1.38.0
image: busybox@sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4
command: [sh, -c]
# Value is passed as an env var (below), never interpolated into the shell,
# so a value containing quotes or shell metacharacters is safe.
args:
- |
set -eu
printf '%s\n' "$VALUE"
env:
- name: VALUE
value: "{{inputs.parameters.value}}"
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.0 latest 2026-07-16
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/conditional-when/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/conditional-when/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/conditional-when \
-p condition=true
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: conditional-when-
spec:
workflowTemplateRef:
name: conditional-when
arguments:
parameters:
- name: condition
value: "true"
As a step of a larger workflow
steps:
- - name: conditional-when
templateRef:
name: conditional-when
template: guard