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

MR/PR or Tag push from Gitlab to multibranch pipeline

    Details

    • Similar Issues:

      Description

      We use Jenkins multibranch pipelines to build different projects from a private Gitlab server.

      We succesfully implemented the webhook from gitlab so that any push event triggers a build on Jenkins.

       

      We are however, unable to trigger any kind of build for "Tag push" or "Merge request" events. Gitlab succesfully triggers the webhook but Jenkins does not detect any changes in the branches and therefore does not build anything.

       

      I am now wondering if the following could be implemented :

      • Whenever a MR or Tag push event is triggered, Jenkins multibranch could pick up the event, create a build with that specific context (clone the tag for a tag push or checkout the MR and build it for a MR event).
      • This would create a new element in the list of builds in the multibranch view

       

      What do you think ? is there any other way this could be done ?

        Attachments

          Activity

          Hide
          svanoort Sam Van Oort added a comment -

          rsandell  This might be of interest?  I'm not as familiar with this part of the codebase, so you might be able to comment on what it would take?

          Show
          svanoort Sam Van Oort added a comment - rsandell   This might be of interest?  I'm not as familiar with this part of the codebase, so you might be able to comment on what it would take?
          Hide
          felixoid Mikhail Shiryaev added a comment -

          Any news, rsandell or Denis Saponenko ?

          This is kinda painfull…

          Show
          felixoid Mikhail Shiryaev added a comment - Any news, rsandell or Denis Saponenko ? This is kinda painfull…
          Hide
          tomasbjerre Tomas Bjerre added a comment -

          You can use Generic Webhook Trigger Plugin:
           
          https://github.com/jenkinsci/generic-webhook-trigger-plugin
           
          You will need to setup a filter to trigger only for specific events. That is documented here:
           
          https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/src/test/resources/org/jenkinsci/plugins/gwt/bdd/gitlab
           
          And here is something to get you started with the Jenkinsfile:
           
          https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/sandbox/multibranch.jenkinsfile
           

          Show
          tomasbjerre Tomas Bjerre added a comment - You can use Generic Webhook Trigger Plugin:   https://github.com/jenkinsci/generic-webhook-trigger-plugin   You will need to setup a filter to trigger only for specific events. That is documented here:   https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/src/test/resources/org/jenkinsci/plugins/gwt/bdd/gitlab   And here is something to get you started with the Jenkinsfile:   https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/sandbox/multibranch.jenkinsfile  
          Hide
          amarruedo Asier Marruedo added a comment -

          I think this problem is the same as the one I'm facing, and it is related to git plugin rather than pipeline-multibranch-defaults-plugin. I filled an issue here. Every time time Gitlab hook forces a jenkins job scan, git plugin does not fetch neither tags, nor merge-requests.

          I've started testing the last version of git plugin (3.9.1) this week, and now, there are two new configuration options that weren`t available when I filled the issue (Discover tags and Discover other refs), that almost make things work again. I'm able to fetch branches and tags, but I'm struggling configuring git plugin to also fetch merge-requests from Gitlab. Would be nice some documentation on correct git plugin configuration for Gitlab use case, but I haven´t found any.

          Show
          amarruedo Asier Marruedo added a comment - I think this problem is the same as the one I'm facing, and it is related to git plugin rather than pipeline-multibranch-defaults-plugin. I filled an issue here . Every time time Gitlab hook forces a jenkins job scan, git plugin does not fetch neither tags, nor merge-requests. I've started testing the last version of git plugin (3.9.1) this week, and now, there are two new configuration options that weren`t available when I filled the issue ( Discover tags and Discover other refs ), that almost make things work again. I'm able to fetch branches and tags, but I'm struggling configuring git plugin to also fetch merge-requests from Gitlab. Would be nice some documentation on correct git plugin configuration for Gitlab use case, but I haven´t found any.
          Hide
          felixoid Mikhail Shiryaev added a comment -

          Asier Marruedo, no, it doesn't solved for me

          Show
          felixoid Mikhail Shiryaev added a comment - Asier Marruedo , no, it doesn't solved for me

            People

            • Assignee:
              vaimr Denis Saponenko
              Reporter:
              tekinico Nicolas Raynaud
            • Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated: