Skip to content

The Argo Workflow spec: CAPA practice questions

The spec of a Workflow is mostly a list of templates and the name of the entrypoint, the template that runs first. Around that core sit fields that shape the whole run, and reading a manifest quickly depends on knowing which level each field lives at.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What The Argo Workflow spec covers in CAPA

The spec of a Workflow is mostly a list of templates and the name of the entrypoint, the template that runs first. Around that core sit fields that shape the whole run, and reading a manifest quickly depends on knowing which level each field lives at.

spec.arguments holds the global inputs. Parameters declared there are readable in any template as {{workflow.parameters.name}}, and argo submit -p name=value overrides them at submit time without editing the file. Inside a template, inputs.parameters declares what that template expects and {{inputs.parameters.name}} reads it. A step passes values to a template through its own arguments block. Outputs work the same way in reverse: an output parameter takes its value from a file with valueFrom.path, and a script template's standard output appears as outputs.result. Workflow variables also expose run metadata, such as {{workflow.name}} and {{workflow.status}}.

Several spec fields set limits for the whole run. serviceAccountName chooses the service account for all of the workflow's Pods. activeDeadlineSeconds stops the workflow once it has run for that many seconds. parallelism caps how many Pods of this workflow run at once. ttlStrategy deletes the finished Workflow object after a delay that can depend on success or failure, and podGC deletes completed Pods, for example as soon as each one completes. volumeClaimTemplates asks the controller to create persistent volume claims when the run starts and delete them when it ends, which lets steps share a scratch volume.

onExit names an exit handler, a template that runs at the end of the workflow whatever the result was, and reads {{workflow.status}} to decide between cleanup and a failure notice. Lifecycle hooks extend the idea to individual steps or the whole workflow when a condition such as a phase change is met. Many fields also exist on a single template with a narrower scope: retryStrategy, activeDeadlineSeconds, parallelism and the template's own metadata. When a question shows a field, the first thing to settle is whether it sits under spec, which governs the whole run, or under one template, which governs only that task.

Key points

  • spec.arguments parameters are global and read as {{workflow.parameters.name}}.
  • activeDeadlineSeconds, parallelism and serviceAccountName at spec level apply to the whole run.
  • ttlStrategy removes finished Workflow objects; podGC removes completed Pods.
  • onExit runs its template after the workflow ends, whatever the outcome.

Three sample questions

13 CAPA questions on The Argo Workflow spec, 13 with explanations. How practice works

Question 1

In an Argo Workflow template, what is the purpose of the outputs section?
  1. A.To define the workflow's exit conditions, such as which phase triggers the onExit handler
  2. B.To declare the parameters and artifacts the template produces
  3. C.To configure output logging
  4. D.To set environment variables

Correct answer: B

A template's outputs section declares the output parameters (for example from a file via valueFrom.path) and output artifacts it produces, so later steps or tasks can consume them. Why the other options are wrong. "To define the workflow's exit conditions, such as which...": exit handling is configured with the onExit field of the Workflow spec, not in outputs. "To configure output logging": logs are collected separately, and archived with archiveLogs. "To set environment variables": environment variables go in the container spec.

Sources: Argo Workflows docs: Output Parameters, Argo Workflows docs: Artifacts

Question 2

How do you specify that a workflow step should only execute if a previous step failed?
  1. A.Using when: "{{workflow.status}} == Failed" evaluated against the overall workflow result
  2. B.Using when: "{{steps.STEPNAME.status}} == Failed"
  3. C.Using if: failed on the step so it runs only after the preceding step has errored out
  4. D.Using condition: failed

Correct answer: B

Within a steps template, a when expression can read steps.<STEPNAME>.status, the phase status of any previous step, so comparing it to Failed gates the step on that earlier failure. The conditionals page shows when as the field that guards a step. Why the other options are wrong. "Using when: "{{workflow.status}} == Failed" evaluated...": workflow.status is documented only in the exit-handler variable set and describes the whole workflow, not one earlier step. "Using if: failed on the step so it runs only after th...": the step spec has no if field; conditional execution is expressed with when. "Using condition: failed": condition is not a step field either; when is the documented conditional.

Sources: Argo Workflows docs: Conditional Execution, Argo Workflows docs: Workflow Variables

Question 3

What is the correct way to reference an input parameter in an Argo Workflow template?
  1. A.$(inputs.parameters.PARAM_NAME) as in Kubernetes command-argument expansion
  2. B.{{inputs.parameters.PARAM_NAME}}
  3. C.${inputs.parameters.PARAM_NAME} as used for shell variables in the container command
  4. D.%inputs.parameters.PARAM_NAME%

Correct answer: B

Argo substitutes template tags written with double curly braces, so a template reads an input parameter as {{inputs.parameters.NAME}}. The variables reference lists inputs.parameters.<NAME> as the input parameter of a template, and the parameter walk-through passes it into args this way. Why the other options are wrong. "$(inputs.parameters.PARAM_NAME) as in Kubernetes comm...": Argo only interpolates {{ }} tags (simple tags or expression tags starting with {{=); the $(...) form is not a template tag. "${inputs.parameters.PARAM_NAME} as used for shell var...": ${...} is not an Argo template tag, so it would be left as literal text in the container args. "%inputs.parameters.PARAM_NAME%": %...% is not a template tag either; the only documented kinds are simple and expression tags in double braces.

Sources: Argo Workflows docs: Workflow Variables, Argo Workflows docs: Parameters

Practice this topic

Focus mode keeps every question on The Argo Workflow spec until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CAPA practice across all topics.

Sources

The explanation above was checked against these official documents.