Skip to content

Tekton converts double dollar symbols to one #3871

@MartinKanters

Description

@MartinKanters

Expected Behavior

When the script element in a Tekton Task definition has double dollar symbols, it should remain as two dollar symbols.

Actual Behavior

When the script element in a Tekton Task definition has double dollar symbols, the two symbols are reduced to one dollar symbol.

Steps to Reproduce the Problem

  1. Apply the Sample TaskRun manifest defined at the bottom of this description
  2. See the output log of Tekton. (also at the bottom)
  3. I have verified that it is not a bug in the output log itself.

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", 
    GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-22T19:05:30Z", 
    GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", 
    GitCommit:"14f897abdc7b57f0850da68bd5959c9ee14ce2fe", GitTreeState:"clean", BuildDate:"2021-01-22T17:29:38Z", 
    GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
    
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

    v0.22.0


Sample TaskRun:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  generateName: dollar-dollar-taskrun-
spec:
  taskSpec:
    steps:
      - name: dollar-dollar-demo
        image: alpine:latest
        script: |
          echo 'two dollar signs: $$'
          echo 'four dollar signs: $$$$'
          echo 'two dollar signs from an environment variable: ' $DOLLAR_DOLLAR_ENV
        env:
          - name: DOLLAR_DOLLAR_ENV
            value: '$$'

Generated output (The lines prefixed with + are the result of the set -x which is added implicitly by Tekton):

+ echo 'two dollar signs: $'
two dollar signs: $
+ echo 'four dollar signs: $$'
four dollar signs: $$
+ echo 'two dollar signs from an environment variable: ' '$'
two dollar signs from an environment variable:  $

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions