Argo 工作流抛出'/bin/sh: arithmetic syntax error'



我是使用Argo工作流的新手。我写下了一个示例工作流程用于演示。下面是所附的工作流程YAML,我在最后一步中面临这个问题。最后一步sayHello出错,退出状态为2,日志显示错误为:

'/bin/sh:算术语法错误'

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: program-1-prints
spec:
entrypoint: main
templates:
- name: main
steps:
- - name: addTwoNos
template: addTwoNosTemplate
arguments:
parameters:
- name: a
value: '2'
- name: b
value: '4'
- - name: addTenToResult
template: addTwoNosTemplate
arguments:
parameters:
- name: a
value: '{{steps.addTwoNos.outputs.result}}'
- name: b
value: '10'
- - name: sayHello
template: sayHello
when: '{{steps.addTenToResult.outputs.result}} > 10'
- name: addTwoNosTemplate
inputs:
parameters:
- name: a
- name: b
container:
image: 'alpine:latest'
command:
- sh
- '-c'
args:
- 'echo $(( {{inputs.parameters.a}} + {{inputs.parameters.b}} ))'
- name: sayHello
inputs:
parameters:
- name: result
value: '{{steps.addTenToResult.outputs.result}}'
container:
image: 'alpine:latest'
command:
- sh
- '-c'
args:
- 'echo $(( {{inputs.parameters.result}} ))'

sayHello模板的result输入必须从main模板的第三步显式传递。

steps.addTenToResult.outputs.resultsayHello模板定义中没有任何意义。以steps.开头的变量仅在步骤模板(即填充了steps字段的模板,如main(中具有意义。

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: program-1-prints
spec:
entrypoint: main
templates:
- name: main
steps:
- - name: addTwoNos
template: addTwoNosTemplate
arguments:
parameters:
- name: a
value: '2'
- name: b
value: '4'
- - name: addTenToResult
template: addTwoNosTemplate
arguments:
parameters:
- name: a
value: '{{steps.addTwoNos.outputs.result}}'
- name: b
value: '10'
- - name: sayHello
template: sayHello
when: '{{steps.addTenToResult.outputs.result}} > 10'
arguments:
parameters:
- name: result
value: '{{steps.addTenToResult.outputs.result}}'
- name: addTwoNosTemplate
inputs:
parameters:
- name: a
- name: b
container:
image: 'alpine:latest'
command:
- sh
- '-c'
args:
- 'echo $(( {{inputs.parameters.a}} + {{inputs.parameters.b}} ))'
- name: sayHello
inputs:
parameters:
- name: result
container:
image: 'alpine:latest'
command:
- sh
- '-c'
args:
- 'echo $(( {{inputs.parameters.result}} ))'

相关内容

  • 没有找到相关文章

最新更新