argo-workflows icon indicating copy to clipboard operation
argo-workflows copied to clipboard

Unable to use input parameter inside jsonpath filter.

Open aaronmell opened this issue 2 years ago • 2 comments

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 👍.

aaronmell avatar Aug 27 '22 19:08 aaronmell

Not a bug.

alexec avatar Sep 05 '22 20:09 alexec

Not a bug.

Is there a workaround? Or is it just not supported?

aaronmell avatar Sep 06 '22 13:09 aaronmell

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.

stale[bot] avatar Oct 01 '22 17:10 stale[bot]

This issue has been closed due to inactivity. Feel free to re-open if you still encounter this issue.

stale[bot] avatar Oct 16 '22 00:10 stale[bot]