pipeline: Param Values container $$ are handled incorrectly

Expected Behavior

If param value is Heloo$$World, it should preserve the value as Hello$$World

Actual Behavior

If param value is Heloo$$World, it is interpreted as Hello$World

Steps to Reproduce the Problem

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: print
  annotations:
    tekton.dev/output_artifacts: '{}'
    tekton.dev/input_artifacts: '{}'
    tekton.dev/artifact_bucket: mlpipeline
    tekton.dev/artifact_endpoint: minio-service.kubeflow:9000
    tekton.dev/artifact_endpoint_scheme: http://
    tekton.dev/artifact_items: '{"print": []}'
    sidecar.istio.io/inject: "false"
    pipelines.kubeflow.org/big_data_passing_format: $(workspaces.$TASK_NAME.path)/artifacts/$ORIG_PR_NAME/$TASKRUN_NAME/$TASK_PARAM_NAME
    pipelines.kubeflow.org/pipeline_spec: '{"inputs": [{"name": "msg1", "type": "String"},
      {"name": "msg2", "type": "String"}, {"name": "msg3", "type": "String"}], "name":
      "print"}'
spec:
  params:
  - name: msg1
    value: 'Hello$World'
  - name: msg2
    value: 'Hello$$World'
  - name: msg3
    value: 'Hello$$$World'
  pipelineSpec:
    params:
    - name: msg1
    - name: msg2
    - name: msg3
    tasks:
    - name: print
      params:
      - name: msg1
        value: $(params.msg1)
      - name: msg2
        value: $(params.msg2)
      - name: msg3
        value: $(params.msg3)
      taskSpec:
        steps:
        - name: main
          command:
          - sh
          - -c
          - |
            set -e
            echo $0
            echo $1
            echo $2
          - $(inputs.params.msg1)
          - $(inputs.params.msg2)
          - $(inputs.params.msg3)
          image: alpine:3.6
        params:
        - name: msg1
        - name: msg2
        - name: msg3
        metadata:
          labels:
            pipelines.kubeflow.org/pipelinename: ''
            pipelines.kubeflow.org/generation: ''
            pipelines.kubeflow.org/cache_enabled: "true"
          annotations:
            pipelines.kubeflow.org/component_spec_digest: '{"name": "print", "outputs":
              [], "version": "print@sha256=31440a8ab18c8ba984932d31ed033270af4f1787c4987762c68930fd032ffeaf"}'
            tekton.dev/template: ''
      timeout: 525600m
  timeout: 525600m

Output from above script

Hello$World
Hello$World
Hello$$World

Additional Info

  • Kubernetes version: Kubernetes Version: 1.23

  • Tekton Pipeline version: Tekton Version: 0.35

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I verified that right before the creation of the Pod to run the task, the substitutions are indeed correct. i.e. Hello$World, Hello$$World and Hello$$$World. However, in the entry pointer, if I log the input command and args, I see it update Hello$World Hello$World Hello$$World. That led me to think that it may be a kubernetes thing. Somehow Kubernetes updates the command and args.

So, I tried to create this Pod:

apiVersion: v1
kind: Pod                      
metadata:
  name: command-demo
  labels:                      
    purpose: demonstrate-command    
spec:
  containers:                  
  - name: command-demo-container  
    image: alpine              
    command: ["echo"]          
    args: ["Hello$World", "Hello$$World", "Hello$$$World"]

The output I see is indeed affected: Hello$World Hello$World Hello$$World

Seems like Kubernetes is changing the $signs somehow.