Argo Workflow 抛出“/bin/sh:算术语法错误”
Argo Workflow throwing '/bin/sh: arithmetic syntax error'
我是 Argo Workflows 的新手。为了演示目的,我写下了一个示例工作流程。下面是附加的工作流 YAML,我在最后一步中遇到了这个问题。最后一步 sayHello 出错,退出状态为 2,日志显示错误为:
'/bin/sh: arithmetic syntax error'
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.result
在 sayHello
模板定义中没有意义。以 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}} ))'
我是 Argo Workflows 的新手。为了演示目的,我写下了一个示例工作流程。下面是附加的工作流 YAML,我在最后一步中遇到了这个问题。最后一步 sayHello 出错,退出状态为 2,日志显示错误为:
'/bin/sh: arithmetic syntax error'
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.result
在 sayHello
模板定义中没有意义。以 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}} ))'