'Unable to use jsonpath function for output parameter in Argo Workflows
I've one workflow in which I'm using jsonpath function for a output parameter to extract a specific value from json string, but it is failing with this error Error (exit code 255)
Here is my workflow
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: wf-dev-
spec:
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: dev-create
templateRef:
name: dev-create-wft
template: main
arguments:
parameters:
- name: param1
value: "val1"
- name: dev-outputs
depends: dev-create.Succeeded
templateRef:
name: dev-outputs-wft
template: main
arguments:
parameters:
- name: devoutputs
value: "{{=jsonpath(tasks.dev-create.outputs.parameters.devoutputs, '$.alias.value')}}"
In the above workflow task dev-create invokes another workflowTemplate dev-create-wft which returns the output of another workflowTemplate
Here is my workflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: dev-create-wft
spec:
entrypoint: main
templates:
- name: main
outputs:
parameters:
- name: devoutputs
valueFrom:
expression: "tasks['dev1'].outputs.parameters.devoutputs"
inputs:
parameters:
- name: param1
dag:
tasks:
- name: dev1
templateRef:
name: fnl-dev
template: main
arguments:
parameters:
- name: param1
value: "{{inputs.parameters.param1}}"
The returned json output looks like this
{
"alias": {
"value": "testing:dev1infra",
"type": "string",
"sensitive": false
},
"match": {
"value": "dev1infra-testing",
"type": "string",
"sensitive": false
}
}
Does jsonpath function supported in workflow? The reason why am asking is, it's working when I used the same function in another workflowTemplate dev-outputs-wft
What could be the issue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
