Documentation
¶
Overview ¶
Package keys is the single location where every workflow variable is declared. Each package-level var is a handle produced by variables.Define and is the only object through which code may read or write that variable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( CronWorkflowName = cronVar("cronworkflow.name", "string", "CronWorkflow object name") CronWorkflowNamespace = cronVar("cronworkflow.namespace", "string", "CronWorkflow namespace") CronWorkflowLabels = cronVar("cronworkflow.labels", "map", "CronWorkflow labels as a map; supports nested key access (cronworkflow.labels.foo)") CronWorkflowAnnotations = cronVar("cronworkflow.annotations", "map", "CronWorkflow annotations as a map; supports nested key access (cronworkflow.annotations.foo)") CronWorkflowLabelsJSON = cronVar("cronworkflow.labels.json", "json", "CronWorkflow labels as a JSON object") CronWorkflowAnnotationsJSON = cronVar("cronworkflow.annotations.json", "json", "CronWorkflow annotations as a JSON object") CronWorkflowFailed = cronVar("cronworkflow.failed", "int", "Count of failed child Workflows") CronWorkflowSucceeded = cronVar("cronworkflow.succeeded", "int", "Count of succeeded child Workflows") CronWorkflowLastScheduledTime = cronVar("cronworkflow.lastScheduledTime", "*time.Time", "Time the cron last triggered, or nil before the first run") )
cronworkflow.* — CronWorkflow expression scope.
var ( WorkflowName = global("workflow.name", "string", "Workflow object name") WorkflowNamespace = global("workflow.namespace", "string", "Workflow namespace") WorkflowUID = global("workflow.uid", "string", "Workflow UID") WorkflowCreationTimestamp = global("workflow.creationTimestamp", "string", "RFC3339 creation timestamp") WorkflowMainEntrypoint = global("workflow.mainEntrypoint", "string", "spec.entrypoint") WorkflowServiceAccountName = global("workflow.serviceAccountName", "string", "Effective service account name") WorkflowPriority = global("workflow.priority", "string", "Workflow priority. Conditional — resolves only when spec.priority is set; otherwise both lint and runtime treat the reference as undefined (no empty/zero fallback).") )
workflow.* identity (always available)
var ( WorkflowParametersByName = global("workflow.parameters.<name>", "string", "Value from spec.arguments.parameters, ConfigMap-resolved if ValueFrom is set") WorkflowParametersAll = global("workflow.parameters", "json", "All workflow parameters as a JSON array") )
workflow.parameters.*
var ( WorkflowLabelsByName = global("workflow.labels.<name>", "string", "Workflow metadata label value") WorkflowAnnotationsByName = global("workflow.annotations.<name>", "string", "Workflow metadata annotation value") )
workflow.labels.*, workflow.annotations.*
var ( WorkflowStatus = runtime("workflow.status", "string", "Current workflow phase; final value only at exit handler", v.PhPreDispatch, v.PhDuringExecute, v.PhExitHandler) WorkflowDuration = runtime("workflow.duration", "string", "Elapsed seconds as float string; final at exit handler", v.PhPreDispatch, v.PhDuringExecute, v.PhExitHandler) WorkflowFailures = runtime("workflow.failures", "json", "Failed-node descriptors. Wire format: a strconv.Quote-wrapped JSON string — consumers must JSON-decode twice. When no nodes have failed, the value is the literal 6-character string \"null\" (with quotes), not an empty array.", v.PhExitHandler) )
workflow.status / duration / failures (runtime)
var ( InputsParameterByName = input("inputs.parameters.<name>", "string", "Resolved input parameter value", anyTmpl) InputsParametersAll = input("inputs.parameters", "json", "All input parameters as a JSON array", anyTmpl) InputsArtifactByName = input("inputs.artifacts.<name>", "wfv1.Artifact", "Input artifact object (for fromExpression use)", anyTmpl) InputsArtifactPathByName = input("inputs.artifacts.<name>.path", "string", "Mount path of the input artifact inside the pod", podKindsOnExit) )
inputs.parameters.*, inputs.artifacts.*
var ( OutputsArtifactPathByName = output("outputs.artifacts.<name>.path", "string", "Declared output artifact path for the current template (pod side)", podKindsOnExit) OutputsParameterPathByName = output("outputs.parameters.<name>.path", "string", "Declared output parameter path for the current template (pod side)", podKindsOnExit) )
outputs.*.path — declared output-side paths (pod-side).
var ( Item = item("item", "string or json", "Current loop iteration value (withItems/withParam). JSON for map/list items.") ItemByKey = item("item.<key>", "string", "Accessor into a map-typed loop iteration value") )
var ( MetricDuration = metric("duration", "Current node's elapsed duration in seconds") MetricStatus = metric("status", "Current node's phase") MetricExitCode = metric("exitCode", "Current node's container exit code") MetricResourcesDurationByName = metric("resourcesDuration.<resource>", "Current node's resource duration in seconds, keyed by Kubernetes resource name (e.g. cpu, memory)") MetricOutputsResult = metric("outputs.result", "Current node's captured stdout (metric scope only)") MetricOutputsParameterByName = metric("outputs.parameters.<name>", "Current node's named output parameter value (metric scope only)") )
metric-emission scope: bare current-node references valid only inside a Prometheus metric expression. They do not leak into the regular template substitution scope.
var ( // pod.name is in scope for any pod-producing body, including an // exit-handler template whose body is itself container/script/resource. PodName = nodeCtx("pod.name", "Computed pod name for pod-producing templates", podKindsOnExit) NodeName = nodeCtx("node.name", "Full node name", anyTmpl) StepsName = nodeCtx("steps.name", "Name of the current step (inside a Steps template body)", []v.TemplateKind{v.TmplSteps}) TasksName = nodeCtx("tasks.name", "Name of the current task (inside a DAG template body)", []v.TemplateKind{v.TmplDAG}) )
var ( StepsNodeRef = nodeRef("steps", v.TmplSteps) TasksNodeRef = nodeRef("tasks", v.TmplDAG) )
var ( StepsAggregate = aggregate("steps", v.TmplSteps) TasksAggregate = aggregate("tasks", v.TmplDAG) )
var ( WorkflowOutputsParameterByName = v.Define(v.Spec{ Template: "workflow.outputs.parameters.<name>", Kind: v.KindNodeRef, ValueType: "string", AppliesTo: []v.TemplateKind{v.TmplAll}, Phases: []v.LifecyclePhase{v.PhDuringExecute, v.PhExitHandler}, Description: "Global output parameter (lifted via outputs.parameters[*].globalName)", }) WorkflowOutputsArtifactByName = v.Define(v.Spec{ Template: "workflow.outputs.artifacts.<name>", Kind: v.KindNodeRef, ValueType: "wfv1.Artifact", AppliesTo: []v.TemplateKind{v.TmplAll}, Phases: []v.LifecyclePhase{v.PhDuringExecute, v.PhExitHandler}, Description: "Global output artifact (lifted via outputs.artifacts[*].globalName)", }) )
workflow.outputs.* (lifted via globalName).
var ( Retries = retry("retries", "0-based retry attempt index") RetriesLastExitCode = retry("lastRetry.exitCode", "Exit code of the previous attempt (or 0 on first attempt)") RetriesLastStatus = retry("lastRetry.status", "Phase of the previous attempt (or empty on first)") RetriesLastDuration = retry("lastRetry.duration", "Duration of the previous attempt in seconds") RetriesLastMessage = retry("lastRetry.message", "Message of the previous attempt") )
var ( WorkflowCreationTimestampFmt = global("workflow.creationTimestamp.<fmt>", "string", "strftime-formatted workflow creation time; `<fmt>` is one of the chars in util/strftime") WorkflowCreationTimestampUnix = global("workflow.creationTimestamp.s", "string", "Workflow creation time as Unix seconds") WorkflowCreationTimestampRFC3339 = global("workflow.creationTimestamp.RFC3339", "string", "Workflow creation time as RFC3339") )
workflow.creationTimestamp formatters (strftime).
var ( WorkflowAnnotationsAll = global("workflow.annotations", "json", "All workflow annotations as a JSON object (deprecated — use workflow.annotations.json)") WorkflowAnnotationsJSON = global("workflow.annotations.json", "json", "All workflow annotations as a JSON object") WorkflowLabelsAll = global("workflow.labels", "json", "All workflow labels as a JSON object (deprecated — use workflow.labels.json)") WorkflowLabelsJSON = global("workflow.labels.json", "json", "All workflow labels as a JSON object") )
Whole-JSON labels / annotations forms.
var WorkflowParametersJSON = global("workflow.parameters.json", "json",
"All workflow parameters as a JSON array (alias for workflow.parameters)")
WorkflowParametersJSON is the alternative whole-parameters JSON form. Legacy code writes both this and WorkflowParametersAll.
var WorkflowScheduledTime = global("workflow.scheduledTime", "string",
"Scheduled time for cron-triggered workflows. Conditional — resolves only when annotation `workflows.argoproj.io/scheduled-time` is present (set automatically by the cron controller). Lint passes via prefix exemption but on a non-cron Workflow the runtime leaves the literal `{{workflow.scheduledTime}}` in resolved values rather than substituting empty.")
WorkflowScheduledTime is the scheduled time for cron-triggered workflows.
Functions ¶
This section is empty.
Types ¶
type AggregateKeys ¶
AggregateKeys are the per-loop outputs of a withItems/withParam group.
type NodeRefKeys ¶
type NodeRefKeys struct {
ID, Status, StartedAt, IP, HostNodeName *v.Key
FinishedAt, ExitCode *v.Key
OutputsResult *v.Key
OutputsParameterByName *v.Key
OutputsArtifactByName *v.Key
}
NodeRefKeys bundles every variable that refers to a sibling node (steps or tasks). The same shape applies to both; instantiated twice.