forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for DAG templates to have output parameters/artifacts
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Test to verify parameters and artifacts can be passed into and out of nested dag | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: nested-dag-outputs- | ||
spec: | ||
entrypoint: nested-dag-outputs | ||
templates: | ||
- name: nested-dag-outputs | ||
dag: | ||
tasks: | ||
- name: generate | ||
template: generate | ||
- name: nested-wf | ||
dependencies: [generate] | ||
template: nested-wf | ||
arguments: | ||
parameters: | ||
- name: nested-in-parameter | ||
value: "{{tasks.generate.outputs.parameters.out-parameter}}" | ||
artifacts: | ||
- name: nested-in-artifact | ||
from: "{{tasks.generate.outputs.artifacts.out-artifact}}" | ||
- name: consume | ||
dependencies: [nested-wf] | ||
template: consume | ||
arguments: | ||
parameters: | ||
- name: in-parameter | ||
value: "{{tasks.nested-wf.outputs.parameters.nested-out-parameter}}" | ||
artifacts: | ||
- name: in-artifact | ||
from: "{{tasks.nested-wf.outputs.artifacts.nested-out-artifact}}" | ||
|
||
# container template which generates an output parameter and artifact | ||
- name: generate | ||
container: | ||
image: docker/whalesay:latest | ||
command: [sh, -c] | ||
args: [" | ||
cowsay hello world | tee /tmp/my-output-artifact.txt && | ||
echo 'my-output-parameter' > /tmp/my-output-parameter.txt | ||
"] | ||
outputs: | ||
parameters: | ||
- name: out-parameter | ||
valueFrom: | ||
path: /tmp/my-output-parameter.txt | ||
artifacts: | ||
- name: out-artifact | ||
path: /tmp/my-output-artifact.txt | ||
# dag template which consumes an input artifact and also produces | ||
# its own output parameters and artifacts taken from one of its tasks. | ||
- name: nested-wf | ||
inputs: | ||
parameters: | ||
- name: nested-in-parameter | ||
artifacts: | ||
- name: nested-in-artifact | ||
dag: | ||
tasks: | ||
- name: consume | ||
template: consume | ||
arguments: | ||
parameters: | ||
- name: in-parameter | ||
value: "{{inputs.parameters.nested-in-parameter}}" | ||
artifacts: | ||
- name: in-artifact | ||
from: "{{inputs.artifacts.nested-in-artifact}}" | ||
- name: generate | ||
template: generate | ||
outputs: | ||
parameters: | ||
- name: nested-out-parameter | ||
valueFrom: | ||
parameter: "{{tasks.generate.outputs.parameters.out-parameter}}" | ||
artifacts: | ||
- name: nested-out-artifact | ||
from: "{{tasks.generate.outputs.artifacts.out-artifact}}" | ||
|
||
# container template which consumes an input parameter and artifact | ||
- name: consume | ||
inputs: | ||
parameters: | ||
- name: in-parameter | ||
artifacts: | ||
- name: in-artifact | ||
path: /tmp/art | ||
container: | ||
image: alpine:3.7 | ||
command: [sh, -c] | ||
args: [" | ||
echo 'input parameter value: {{inputs.parameters.in-parameter}}' && | ||
echo 'input artifact contents:' && | ||
cat /tmp/art | ||
"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters