<p>I created a very simple task that checks if the current branch on a git repo is a release branch</p>
<pre><code>apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: check-git-remote-release-branches
spec:
  params:
    - default: .
      description: The location of the root folder
      name: PATH_CONTEXT
      type: string
    - default: master
      description: Git reference
      name: GIT_REF
      type: string
  results:
    - description: true if release branch
      name: is-release-branch
  steps:
    - image: 'registry.redhat.io/rhel8/nodejs-16:latest'
      name: retrieving-remote-release-branches
      resources: {}
      script: &gt;
        #!/bin/bash  

        set -x

        git config --global --add safe.directory '*'

        git config --global user.email &quot;git@48hg.ch&quot; 

        git config --global user.name &quot;48hG - CICD&quot; 

        REMOTE_RELEASE_BRANCHES=($(git ls-remote --heads origin |  grep release/
        | awk '{print $2}'))

        echo &quot;Current ref $(params.GIT_REF)&quot;

        echo REMOTE_RELEASE_BRANCHES

        echo &quot;false&quot; | tee $(results.is-release-branch.path)

        for element in &quot;${REMOTE_RELEASE_BRANCHES[@]}&quot;;  do
            echo &quot;$element&quot;
            if [[ $element == $(params.GIT_REF) ]]; then
                echo &quot;true&quot; | tee $(results.is-release-branch.path)
            fi
        done

        cat $(results.is-release-branch.path)
      workingDir: /workspace/source/$(params.PATH_CONTEXT)
  workspaces:
    - name: source
</code></pre>
<p>In my Tekton pipeline i setup a task that writes on a &quot;result&quot; true if the branch is a release branch.</p>
<pre><code>    - name: check-git-remote-release-branches
          params:
            - name: PATH_CONTEXT
              value: $(params.context_path)
            - name: GIT_REF
              value: $(params.git-ref)
          runAfter:
            - continuous-integration-nodejs
          taskRef:
            kind: Task
            name: check-git-remote-release-branches
          workspaces:
            - name: source
              workspace: source-workspace
</code></pre>
<p>A subsequent task uses this result to evaluate a when clause:</p>
<pre><code>    - name: release-increase-version
      params:
        - name: PATH_CONTEXT
          value: $(params.context_path)
      runAfter:
        - check-git-remote-release-branches
      taskRef:
        kind: Task
        name: nodejs-release-commit
      when:
        - input: $(tasks.check-git-remote-release-branches.results.is-release-branch)
          operator: in
          values:
            - 'true'
</code></pre>
<p>the when clause does never work even if true is wrote in the right file.
How can i debug this? is there a way for me to check why the comparison fails?</p>

Otrebor
<p>I suspect the issue is related to how the result is produced:</p>
<pre><code>echo &quot;true&quot; | tee $(results.is-release-branch.path)
</code></pre>
<p>Using <code>echo</code> will produce <code>true\n</code> as a result, which does not match the <code>when</code> expression.
I would recommend changing the task definition to:</p>
<pre><code>printf &quot;true&quot; | tee $(results.is-release-branch.path)
</code></pre>
