I have the following Workflow YAML file:
---
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: repro-expression-broken-
spec:
entrypoint: repro-expressions
ttlStrategy:
secondsAfterCompletion: 3600
secondsAfterSuccess: 3600
secondsAfterFailure: 86400 # Keep workflows which fail for 1 day so that they can be investigated
templates:
- name: repro-expressions-main
steps:
- - name: reserve-release
template: repro-expressions
- name: repro-expressions
inputs:
parameters:
- name: abc
value: "{{=now() - duration(1h)}}"
script:
image: "alpine"
command: [ash]
source: |
echo "test expression 1: {{=now()}}"
echo "test expression 2: {{=2+2}}"
echo "test expression 3: {{=split('apple,orange,grape', ',')}}"
echo "test expression 4: {{=[max(5,7),9]}}"
echo "test expression 5: {{=[1,3,5]}}"
echo "test expression 6: {{='this is a string'}}"
echo "test input expression: {{inputs.parameters.abc}}"
Submitting this workflow (argo v3.4.13) generates the following output in the logs:
repro-expression-broken-qrxzs: test expression 1: {{=now()}}
repro-expression-broken-qrxzs: test expression 2: 4
repro-expression-broken-qrxzs: test expression 3: {{=split('apple,orange,grape', ',')}}
repro-expression-broken-qrxzs: test expression 4: {{=[max(5,7),9]}}
repro-expression-broken-qrxzs: test expression 5: [1 3 5]
repro-expression-broken-qrxzs: test expression 6: this is a string
repro-expression-broken-qrxzs: test input expression: {{=now() - duration(1h)}}
repro-expression-broken-qrxzs: time="2023-11-23T10:21:33.612Z" level=info msg="sub-process exited" argo=true error="<nil>"
All the expressions that have function calls have failed to resolve to a value. Why is this?