Uploaded image for project: 'OpenShift Pipelines'
  1. OpenShift Pipelines
  2. SRVKP-6981

Using the body in a Pipelines-as-Code parameter not working with bitbucket

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Hide
      In Bitbucket Server push event, users weren't able to reference all fields of `body.changes` object in PipelineRun dynamic variables from webhook event payload. With this update it will work fine.
      ```
      spec:
        params:
          - name: ref_id
            value: "{{ body.changes[0].ref.id }}"
      ```
      Show
      In Bitbucket Server push event, users weren't able to reference all fields of `body.changes` object in PipelineRun dynamic variables from webhook event payload. With this update it will work fine. ``` spec:   params:     - name: ref_id       value: "{{ body.changes[0].ref.id }}" ```

      Description of problem:

      According to the documentation, using the header and body of the payload for CEL-based filtering with Pipelines as Code is a Technology Preview feature only.

      Accessing arrays does not work in a PipelineRun like in the given example below.

      Steps to Reproduce

       # Install a latest release of OpenShift Pipelines

      1. Create a pipeline run and access an Array from the body like below
      apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: "metrics-checker-release-{{sender}}-"
        annotations:
          pipelinesascode.tekton.dev/on-cel-expression: |
            event == "push" && target_branch == "abc-pac-test" && body.actor.name == "abc"
          pipelinesascode.tekton.dev/pipeline: ".tekton/pipelines/python-build-deploy.yaml"
          pipelinesascode.tekton.dev/max-keep-runs: "3"
      spec:
        serviceAccountName: pipeline
        pipelineRef:
          name: python-build-deploy
        podTemplate:
          nodeSelector:
            node-role.kubernetes.io/infra: ""
          tolerations:
            - key: infra
              effect: NoExecute
              value: reserved
        params:
          - name: git-url
            value: "{{body.changes[0].ref.id}}"
          - name: git-revision
            value: "{{target_branch}}"
        workspaces:
          - name: source-app
            volumeClaimTemplate:
              spec:
                accessModes:
                  - ReadWriteMany
                resources:
                  requests:
                    storage: 1Gi
                storageClassName: hnas-nfs-csi-sc
      

       

      Actual results:

      The param git-url is set as `body.changes[0].ref.id`

      Expected results:

      The param git-url is parsed from the body and set properly

      Reproducibility (Always/Intermittent/Only Once):

      Always

      Acceptance criteria:

      Body and header getting parsed

       

      Definition of Done:

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

       

       *

              rh-ee-zashaikh Zaki Shaikh
              rhn-support-anowak Andreas Nowak
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: