openshift-pipelines/pipelines-as-code

issue with on-comment trigger_comment

Closed this issue · 0 comments

there is an issue with on-comment feature and trigger_comment variable unrelated to this PR but for mysterious reasons is failing on #1624 and was not failing in other PRs

The issue is that when the comment is over multiple lines, the comment gets replaced and the yaml become invalid, looks like that for example on the gitlab e2e:

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: "on-comment"
  annotations:
    pipelinesascode.tekton.dev/target-namespace: "pac-e2e-ns-7lkqt"
    pipelinesascode.tekton.dev/on-comment: "^/hello-world"
spec:
  pipelineSpec:
    tasks:
      - name: task
        displayName: "The Task name is Task"
        taskSpec:
          steps:
            - name: task
              image: registry.access.redhat.com/ubi9/ubi-micro
              script: |
                echo "The comment is:"
                cat <<EOF
                **Pipelines as Code CI/on-comment** has successfully validated your commit

<ul>
<li><b>Namespace</b>: <a href="http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns">pac-e2e-ns-7lkqt</a></li>
<li><b>PipelineRun:</b> <a href="http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5">on-comment-jhhx5</a></li>
</ul>
<hr>
<h4>Task Statuses:</h4>


Status | Duration | Name
-- | -- | --
✅ Succeeded | 8 seconds | [The Task name is Task](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5?pipelineTask=task)




<small>Full log available [here](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5)</small>
                EOF

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: "on-comment"
  annotations:
    pipelinesascode.tekton.dev/target-namespace: "pac-e2e-ns-7lkqt"
    pipelinesascode.tekton.dev/on-comment: "^/hello-world"
spec:
  pipelineSpec:
    tasks:
      - name: task
        displayName: "The Task name is Task"
        taskSpec:
          steps:
            - name: task
              image: registry.access.redhat.com/ubi9/ubi-micro
              script: |
                echo "The comment is:"
                cat <<EOF
                **Pipelines as Code CI/on-comment** has successfully validated your commit

<ul>
<li><b>Namespace</b>: <a href="http://dashboard.civuole.local/#/namespaces/[pac-e2e-ns-7lkqt](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns)/pipelineruns">pac-e2e-ns-7lkqt</a></li>
<li><b>PipelineRun:</b> <a href="http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/[on-comment-jhhx5](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5)">on-comment-jhhx5</a></li>
</ul>
<hr>
<h4>Task Statuses:</h4>

<table>
  <tr><th>Status</th><th>Duration</th><th>Name</th></tr>
<tr>
<td>✅ Succeeded</td>
<td>8 seconds</td><td>

[The Task name is Task](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5?pipelineTask=task)

</td></tr>
</table>


<small>Full log available [here](http://dashboard.civuole.local/#/namespaces/pac-e2e-ns-7lkqt/pipelineruns/on-comment-jhhx5)</small>
                EOF

which become wrong in the container:

image

(could not find expected value : thing)

I have a fix whcih I will push in this PR to make it great and would further cleanup later on with unittests

Originally posted by @chmouel in #1624 (comment)