argo-workflows
argo-workflows copied to clipboard
Unable to use input parameter inside jsonpath filter.
Checklist
- [x] Double-checked my configuration.
- [ ] Tested using the latest version.
- [x] Used the Emissary executor.
Summary
What happened/what you expected to happen? Trying to filter some json based on an input parameter. I was hoping that there would be a way to pass an input parameter to a filter.
ENV1 shows a working example of a jsonpath filter in a workflow, that has the filter value hardcoded. ENV2 shows a non-working example.
What version are you running? 3.3.1
Diagnostics
Paste the smallest workflow that reproduces the bug. We must be able to run the workflow.
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: bug-report
spec:
entrypoint: test
templates:
- name: test
inputs:
parameters:
- name: var
value: value2
- name: json
value: |
{"input": [{"key": "value"}, {"key": "value2"}]}
script:
env:
- name: ENV
value: |
{{=jsonpath(inputs.parameters.json, '$.input[?(@.key == \'value2\')].key[0]')}}
- name: ENV2
value: |
{{=jsonpath(inputs.parameters.json, '$.input[?(@.key == \'inputs.parameters.var\')].key[0]')}}
image: alpine:3.16.0
command: [sh]
source: |
echo $ENV;
echo $ENV2;
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
Not a bug.
Not a bug.
Is there a workaround? Or is it just not supported?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a mentoring request, please provide an update here. Thank you for your contributions.
This issue has been closed due to inactivity. Feel free to re-open if you still encounter this issue.