Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters values escaping problem #13718

Open
3 of 4 tasks
DoNck opened this issue Oct 7, 2024 · 0 comments
Open
3 of 4 tasks

Parameters values escaping problem #13718

DoNck opened this issue Oct 7, 2024 · 0 comments
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templating Templating with `{{...}}` P3 Low priority type/bug

Comments

@DoNck
Copy link

DoNck commented Oct 7, 2024

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide)

What happened? What did you expect to happen?

Hi Argo.

I am running the latest stable release (3.5.11) of argo-workflows.
It seems a character escaping issue occurs during template rendering.

When feeding withParams or withItems with special characters, some wrong escaping occurs and container is called with wrong parameters, which is visible in the "inputs/outputs" tab of the side panel.
Depending on the input string, pods can be badly named in the graph view.
screenshot_annotated

Parameters received by the debug pod:
python_debug_logs
(see the note below regarding the debug pod)

Moreover the displayed pod name does not share the same numerical identifier as the "ID". In this situation, the "Logs" button will not work. The logs are accessible from kubectl using the actual pod name (not being displayed).
bad_id

Note: The provided custom image is intended for debugging this particular issue and can be built from this archive docker.zip using the following command: docker build -t localhost:5000/library/printarg:dev . .

As a workfaround, I managed to provide correct parameters to the python script using sprig to post-process the wrong escapes I encountered (double quote and backslashes). You can try calling the python script using param_workaround instead of param parameter.

Version(s)

v3.5.11

Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

metadata:
  name: escaping-problem
spec:
  templates:
    - name: do-something
      inputs:
        parameters:
          - name: param
          - name: param_workaround
      container:
        image: printargs:dev
        command:
          - python
        args:
          - /printarg.py
          - '-a'
          - '{{inputs.parameters.param}}'
        env:
          - name: PYTHONUNBUFFERED
            value: '1'
        imagePullPolicy: Always
    - name: entrypoint
      steps:
        - - name: do-something
            template: do-something
            arguments:
              parameters:
                - name: param
                  value: '{{item}}'
                - name: param_workaround
                  value: >-
                    {{=sprig.replace("\\\\", "\u005c", sprig.replace("\\\"",
                    "\u0022", item))}}
            withItems:
              - abcd
              - efgh
              - ij"kl
              - mn\"op
              - qr\\"st
              - UV&é"'$(-
  entrypoint: entrypoint

Logs from the workflow controller

time="2024-10-07T09:29:11.266Z" level=info msg="Processing workflow" Phase= ResourceVersion=4249744 namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.326Z" level=info msg="Task-result reconciliation" namespace=myns numObjs=0 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.326Z" level=info msg="Updated phase  -> Running" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.328Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.329Z" level=info msg="was unable to obtain node for , letting display name to be nodeName" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.329Z" level=info msg="Steps node escaping-problem-dhwxh initialized Running" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.329Z" level=info msg="StepGroup node escaping-problem-dhwxh-826472279 initialized Running" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.331Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.331Z" level=info msg="Pod node escaping-problem-dhwxh-122118802 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.345Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(0:abcd) (escaping-problem-dhwxh-do-something-122118802)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.345Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.345Z" level=info msg="Pod node escaping-problem-dhwxh-3303604141 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.357Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(1:efgh) (escaping-problem-dhwxh-do-something-3303604141)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.357Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.357Z" level=info msg="Pod node escaping-problem-dhwxh-625910082 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.365Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(2:ij\\\"kl) (escaping-problem-dhwxh-do-something-625910082)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.365Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.366Z" level=info msg="Pod node escaping-problem-dhwxh-195136337 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.373Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(3:mn\\\\\\\"op) (escaping-problem-dhwxh-do-something-195136337)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.373Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.373Z" level=info msg="Pod node escaping-problem-dhwxh-999571824 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.380Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(4:qr\\\\\\\\\\\"st) (escaping-problem-dhwxh-do-something-999571824)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.380Z" level=warning msg="Node was nil, will be initialized as type Skipped" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.380Z" level=info msg="Pod node escaping-problem-dhwxh-1679321178 initialized Pending" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.390Z" level=info msg="Created pod: escaping-problem-dhwxh[0].do-something(5:UV&é\\\"'$-) (escaping-problem-dhwxh-do-something-1679321178)" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.390Z" level=info msg="Workflow step group node escaping-problem-dhwxh-826472279 not yet completed" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.390Z" level=info msg="TaskSet Reconciliation" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.390Z" level=info msg=reconcileAgentPod namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:11.403Z" level=info msg="Workflow update successful" namespace=myns phase=Running resourceVersion=4249767 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.267Z" level=info msg="Processing workflow" Phase=Running ResourceVersion=4249767 namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.267Z" level=info msg="Task-result reconciliation" namespace=myns numObjs=6 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.267Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-195136337 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.268Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-999571824 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.268Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-1679321178 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.268Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-3303604141 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.268Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-625910082 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.268Z" level=info msg="node changed" namespace=myns new.message= new.phase=Succeeded new.progress=0/1 nodeID=escaping-problem-dhwxh-122118802 old.message= old.phase=Pending old.progress=0/1 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Step group node escaping-problem-dhwxh-826472279 successful" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="node escaping-problem-dhwxh-826472279 phase Running -> Succeeded" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="node escaping-problem-dhwxh-826472279 finished: 2024-10-07 09:29:21.270054563 +0000 UTC" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-122118802 is [escaping-problem-dhwxh-122118802]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-3303604141 is [escaping-problem-dhwxh-3303604141]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-625910082 is [escaping-problem-dhwxh-625910082]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-195136337 is [escaping-problem-dhwxh-195136337]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-999571824 is [escaping-problem-dhwxh-999571824]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh-1679321178 is [escaping-problem-dhwxh-1679321178]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Outbound nodes of escaping-problem-dhwxh is [escaping-problem-dhwxh-122118802 escaping-problem-dhwxh-3303604141 escaping-problem-dhwxh-625910082 escaping-problem-dhwxh-195136337 escaping-problem-dhwxh-999571824 escaping-problem-dhwxh-1679321178]" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="node escaping-problem-dhwxh phase Running -> Succeeded" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="node escaping-problem-dhwxh finished: 2024-10-07 09:29:21.270222657 +0000 UTC" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="TaskSet Reconciliation" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg=reconcileAgentPod namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Updated phase Running -> Succeeded" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.270Z" level=info msg="Marking workflow completed" namespace=myns workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.286Z" level=info msg="Workflow update successful" namespace=myns phase=Succeeded resourceVersion=4249915 workflow=escaping-problem-dhwxh
time="2024-10-07T09:29:21.336Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-195136337/labelPodCompleted
time="2024-10-07T09:29:21.337Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-999571824/labelPodCompleted
time="2024-10-07T09:29:21.337Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-122118802/labelPodCompleted
time="2024-10-07T09:29:21.337Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-1679321178/labelPodCompleted
time="2024-10-07T09:29:21.349Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-3303604141/labelPodCompleted
time="2024-10-07T09:29:21.349Z" level=info msg="cleaning up pod" action=labelPodCompleted key=myns/escaping-problem-dhwxh-do-something-625910082/labelPodCompleted

Logs from in your workflow's wait container

time="2024-10-07T09:29:12.836Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-1679321178 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
time="2024-10-07T09:29:13.544Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-195136337 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
time="2024-10-07T09:29:13.310Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-3303604141 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
time="2024-10-07T09:29:12.839Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-625910082 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
time="2024-10-07T09:29:13.326Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-999571824 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
time="2024-10-07T09:29:13.521Z" level=info msg="Executor initialized" deadline="0001-01-01 00:00:00 +0000 UTC" includeScriptOutput=false namespace=myns podName=escaping-problem-dhwxh-do-something-122118802 templateName=do-something version="&Version{Version:v3.5.11,BuildDate:2024-09-20T14:09:00Z,GitCommit:25bbb71cced32b671f9ad35f0ffd1f0ddb8226ee,GitTag:v3.5.11,GitTreeState:clean,GoVersion:go1.21.13,Compiler:gc,Platform:linux/amd64,}"
@DoNck DoNck added the type/bug label Oct 7, 2024
@agilgur5 agilgur5 added area/looping `withParams`, `withItems`, and `withSequence` P3 Low priority area/templating Templating with `{{...}}` labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/looping `withParams`, `withItems`, and `withSequence` area/templating Templating with `{{...}}` P3 Low priority type/bug
Projects
None yet
Development

No branches or pull requests

2 participants