apiVersion:argoproj.io/v1alpha1kind:Workflowmetadata:generateName:output-parameter-spec:entrypoint:output-parametertemplates:- name:output-parametersteps:- - name:generate-parametertemplate:whalesay- - name:consume-parametertemplate:print-messagearguments:parameters:# Pass the hello-param output from the generate-parameter step as the message input to print-message- name:messagevalue:"{{steps.generate-parameter.outputs.parameters.hello-param}}"- name:whalesaycontainer:image:docker/whalesay:latestcommand:[sh, -c]args:["echo -n hello world > /tmp/hello_world.txt"]# generate the content of hello_world.txtoutputs:parameters:- name:hello-param # name of output parametervalueFrom:path:/tmp/hello_world.txt# set the value of hello-param to the contents of this hello-world.txt- name:print-messageinputs:parameters:- name:messagecontainer:image:docker/whalesay:latestcommand:[cowsay]args:["{{inputs.parameters.message}}"]
导出结果
1
2
3
4
5
6
7
8
9
10
- name:whalesaycontainer:image:docker/whalesay:latestcommand:[sh, -c]args:["echo -n hello world > /tmp/hello_world.txt"]# generate the content of hello_world.txtoutputs:parameters:- name:hello-param # name of output parametervalueFrom:path:/tmp/hello_world.txt# set the value of hello-param to the contents of this hello-world.txt
outputs:parameters:- name:hello-param # name of output parametervalueFrom:path:/tmp/hello_world.txt# set the value of hello-param to the contents of this hello-world.txt
定义了一个 output 参数,名为 hello-param,该参数的 value 从 /tmp/hello_world.txt 文件中获取,最终得到的 value 就是之前写入的 hello world。
spec:entrypoint:output-parametertemplates:- name:output-parametersteps:- - name:generate-parametertemplate:whalesay- - name:consume-parametertemplate:print-messagearguments:parameters:# Pass the hello-param output from the generate-parameter step as the message input to print-message- name:messagevalue:"{{steps.generate-parameter.outputs.parameters.hello-param}}"