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

PaC validation reporting does not work on Gitlab fork merge requests

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • Pipelines 1.19.0
    • Pipelines as Code
    • 1
    • False
    • True
    • Hide
      When PaC reports validation errors on GitLab merge requests from repository forks, it was incorrectly using SourceProjectID in API calls. Since merge requests are objects on the TargetProject, this resulted in 404 errors and no comments were added.

      Fixed CreateComment method to use event.TargetProjectID instead of v.sourceProjectID for all merge request operations.
      Show
      When PaC reports validation errors on GitLab merge requests from repository forks, it was incorrectly using SourceProjectID in API calls. Since merge requests are objects on the TargetProject, this resulted in 404 errors and no comments were added. Fixed CreateComment method to use event.TargetProjectID instead of v.sourceProjectID for all merge request operations.
    • Pipelines Sprint Tekshift 34, Pipelines Sprint Tekshift 35, Pipelines Sprint Tekshift 36, Pipelines Sprint Tekshift 37
    • Customer Facing, Customer Reported

      Description of problem:

      When PaC attempts to report .tekton file validation errors on a gitlab merge request from a repository fork, it uses the Source Project ID in its API calls. However since the Merge Request is an object on the TargetProject this results in a 404 and no comments are added. In contrast, when we comment on a merge request with a status update we correctly use the Target Project ID. The Source Project ID should only be used when commenting on a commit.

      Workaround:

      When working on .tekton files in a Gitlab repo, don't use a fork

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

      Steps to Reproduce

      1. Onboard a gitlab project to PaC
      2. fork the onboarded project
      3. commit an invalid pipelinerun to the .tekton directory in the fork
      4. create a merge request to the first project from the fork

      Actual results:

      No pipelines are started and no comments are added with the validation errors

      Expected results:

      PaC does not start any pipelines but comments on the MR with the pipelinerun validation errors

      Reproducibility (Always/Intermittent/Only Once): Always

      Acceptance criteria: 

      When a gitlab merge request from a forked project contains pipelinerun validation errors, those errors are added as comments on the merge request in the target repository

      Definition of Done:

      [] acceptance criteria is met

      [] documentation is updated

      [] release notes are included on this ticket

      [] fix version(s) are added to the ticket

      Build Details:

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

       

      {"level":"error","ts":"2025-07-29T15:16:48.432Z","logger":"pipelinesascode","caller":"events/emit.go:46","msg":"cannot read the PipelineRun: .tekton/nhc-0-9-fbc-415-pull-request.yaml, error: yaml validation error: line 199: did not find expected '-' indicator","commit":"842f13c659870f5bb59c94fd2e92f44b18dbe02a","provider":"gitlab","event-id":"","event-sha":"6de1c742677ce79efd9ee35420f50f216ce1bd45","event-type":"no-ops-comment","namespace":"rhwa-tenant","stacktrace":"github.com/openshift-pipelines/pipelines-as-code/pkg/events.(*EventEmitter).EmitMessage\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/events/emit.go:46\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).reportValidationErrors\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/errors.go:57\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).getPipelineRunsFromRepo\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/match.go:184\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).matchRepoPR\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/match.go:38\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).Run\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/pipelineascode.go:59\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.(*sinker).processEvent\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/adapter/sinker.go:60\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.(*listener).Start.listener.handleEvent.func2.1\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/adapter/adapter.go:206"}{"level":"error","ts":"2025-07-29T15:16:48.503Z","logger":"pipelinesascode","caller":"events/emit.go:46","msg":"failed to create comment: 404 Not Found","commit":"842f13c659870f5bb59c94fd2e92f44b18dbe02a","provider":"gitlab","event-id":"","event-sha":"6de1c742677ce79efd9ee35420f50f216ce1bd45","event-type":"no-ops-comment","namespace":"rhwa-tenant","stacktrace":"github.com/openshift-pipelines/pipelines-as-code/pkg/events.(*EventEmitter).EmitMessage\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/events/emit.go:46\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).reportValidationErrors\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/errors.go:66\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).getPipelineRunsFromRepo\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/match.go:184\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).matchRepoPR\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/match.go:38\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).Run\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode/pipelineascode.go:59\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.(*sinker).processEvent\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/adapter/sinker.go:60\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.(*listener).Start.listener.handleEvent.func2.1\n\t/go/src/github.com/openshift-pipelines/pipelines-as-code/pkg/adapter/adapter.go:206"}

       *

              rh-ee-shubbhar Shubham Bhardwaj
              rh-ee-athorp Andrew Thorp
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: