Skip to content

Instantly share code, notes, and snippets.

@jmettes
Last active July 11, 2022 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmettes/3aac603eb04eb51931dbcb3869066811 to your computer and use it in GitHub Desktop.
Save jmettes/3aac603eb04eb51931dbcb3869066811 to your computer and use it in GitHub Desktop.
Basic usage of Argo WorkflowTemplates, with minimal duplication and boiler plate. The DAG is the only template, using inline sub-templates for tasks (instead of additional task templates), and a single global parameter passed by Workflow at top level (without having redefine the DAG structure to pass separate parameters)
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: workflow-template-submittable
spec:
entrypoint: dag
templates:
- name: dag
inputs:
parameters:
- name: global-parameter
dag:
tasks:
- name: A
inline:
container:
image: docker/whalesay
command: [cowsay]
args: ["hello A"]
- name: B
depends: "A"
inline:
container:
image: docker/whalesay
command: [cowsay]
args: ["{{inputs.parameters.global-parameter}}"]
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: workflow-template-hello-world-
namespace: processing
spec:
arguments:
parameters:
- name: global-parameter
value: "from workflow"
workflowTemplateRef:
name: workflow-template-submittable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment