Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70545

GitLabMergeRequestCommentTrigger triggering incorrect project in specific conditions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins version 2.380
      GitLab version 15.7.5-ee
      gitlab-branch-source plugin version 643.vdc12a_4a_06434
      gitlab-api plugin version 5.0.1-78.v47a_45b_9f78b_7
      gitlab-plugin version 1.6.0

      We have a GitLab group project set up with a number of repositories set up in GitLab, mapped to an "Organization Folder" item in Jenkins and it has been working as expected for a number of months now. Recently we noticed a strange issues that seems to specifically affect only builds triggered by a comment, and only in specific circumstances detailed below:

      Consider the above screenshot of the aforementioned Jenkins "Organization Folder". When we opened a Merge Request on GitLab in the ix/accelerators/context-properties project it correctly identified the Jenkins project and created a new "Merge Request" item in its folder (in our case, named MR-29). This build failed for a valid reason, and after fixing the issue we tried to re-trigger it by posting the assigned keyword as a GitLab comment on the ix/accelerators/context-properties project on GitLab, a functionality which usually works without issues.

      Rather than trigger the correct MR-29 job in the ix/accelerators/context-properties folder however, every time we tried to use the Note event it was triggering the equivalent job MR-29 in the ix/accelerators/card-processing folder instead. The following message was logged on Jenkins with every try (highlighting mismatched project names in colour for visibility):

      INFO    i.j.p.g.GitLabMergeRequestCommentTrigger#isMatch: Triggered build for org-ix/accelerators/ix%2Faccelerators%2Fcard-processing/MR-29 due to MR comment on ix/accelerators/context-properties

      We worked around the issue by issuing a Rebuild of the correct MR-29 from Jenkins itself but it would be good to identify the root cause behind this issue and fix it for future occurrences.

      Any ideas, please?


      Initially we thought it could be due to some URL truncation due to length of project name, but most other projects work fine and we have since also identified the same issue with a number of other project combinations listed below:

       

      Jenkins Job Path GitLab Project Path
      org-ix/accelerators/ix%2Faccelerators%2Fdummy-data-loader/MR-12 ix/accelerators/unique-id
      org-ix/accelerators/ix%2Faccelerators%2Fcard-processing-simulator/MR-10 ix/accelerators/interaction-log
      org-ix/accelerators/ix%2Faccelerators%2Funique-id/MR-12 ix/accelerators/dummy-data-loader

       

            baymac Parichay Barpanda
            tyrone_grech Tyrone Grech
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: