2

我正在关注 Argo GitHub 上的示例,但是当我将模板移动到步骤中时,我无法更改消息的参数。

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-parameters-
spec:
 # invoke the whalesay template with
 # "hello world" as the argument
 # to the message parameter
 entrypoint: entry-point

  templates:
  - name: entry-point
  steps:
    - - name: print-message
        template: whalesay
        arguments:
          parameters:
          - name: message
            value: hello world



 - name: whalesay
   inputs:
     parameters:
     - name: message       # parameter declaration
    container:
    # run cowsay with that message input parameter as args
    image: docker/whalesay
    command: [cowsay]
    args: ["{{inputs.parameters.message}}"]

如果我使用以下命令提交工作流:

argo submit .\workflow.yml -p message="goodbye world"

它仍然打印出你好世界而不是再见世界。不知道为什么

4

1 回答 1

9

-p参数设置在工作arguments流规范字段中定义的全局工作流参数。更多信息可在此处获得。要使用全局参数,您的工作流程应更改如下:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-parameters-
spec:
  # invoke the whalesay template with
  # "hello world" as the argument
  # to the message parameter
  entrypoint: entry-point
  arguments:
    parameters:
    - name: message
      value: hello world

  templates:
  - name: entry-point
    steps:
    - - name: print-message
        template: whalesay
        arguments:
          parameters:
          - name: message
            value: "{{workflow.parameters.message}}"
  - name: whalesay
    inputs:
      parameters:
       - name: message       # parameter declaration
    container:
      # run cowsay with that message input parameter as args
      image: docker/whalesay
      command: [cowsay]
      args: ["{{inputs.parameters.message}}"]

于 2019-06-14T05:40:16.253 回答