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

PaC on-cel body attributes missing when zero-values

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Description of problem:

      When referencing a nested attribute from the event body in an on-cel annotation in PaC, fields which have a zero value become invalid/missing keys if referenced. e.g. event.PullRequestLabels is an empty when the pull request has no labels, so body.pull_request.labels causes the CEL expression fail execution.

      Workaround
      Nested attributes like this have to be accessed with (has(body.pull_request.labels) && body.pull_request.labels...).

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      • Author a pipelinerun with an on-cel expression which references `body.pull_request.labels`
      • Create a pull request with this pipelinerun which does not include any labels

       

      Actual results:

      The pipelinerun fails to start with an error like CEL expression evaluation error: expression }}-- {{failed to evaluate: no such key: pull_request

      Expected results:

      The pipelinerun does not start (if the on-cel does not match) but does not have any errors

      Reproducibility (Always/Intermittent/Only Once): always

      Acceptance criteria: 

      • the on-cel expression does not fail to evaluate when a referenced field is present but empty in the event.

      Definition of Done:

      • acceptance criteria is met
      • unit tests are written
      • KONFLUX-9908 is updated accordingly

      Build Details:

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

       

       *

              Unassigned Unassigned
              rh-ee-athorp Andrew Thorp
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: