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

Gitlab hook not building on merge request object

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm having an issue when I'm filing a merge request within GitLab. When I file a merge request, I do not get a job built, though I have a webhook to listen for a merge request or a push. Every time I get a push, it does build.

      Here's an example of the push request I get from the webhook:

      {"before":"bf12dc027feacfb99cd8e24b1be0993d29652e3d","after":"3ec0e32587f999f4edcb7085859a1af94f62c7ad","ref":"refs/heads/DUMMY_foo_bar_test","user_id":14,"user_name":"adam","project_id":9,"repository":

      {"name":"exchange-api","url":"git@gitlab01.localhost.com:exchange/exchange-api.git","description":"","homepage":"http://gitlab01.localhost.com/exchange/exchange-api"}

      ,"commits":[{"id":"3ec0e32587f999f4edcb7085859a1af94f62c7ad","message":"Fooo bar","timestamp":"2014-10-22T16:14:50-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/3ec0e32587f999f4edcb7085859a1af94f62c7ad","author":{"name":"Adam","email":"Adam@localhost.com"}}],"total_commits_count":1}

      Here is what the Gitlab is sending for a merge_request:

      {"object_kind":"merge_request","object_attributes":{"id":117,"target_branch":"US4395_safenet","source_branch":"DUMMY_foo_bar_test","source_project_id":9,"author_id":14,"assignee_id":null,"title":"Dummy foo bar test","created_at":"2014-10-22 21:52:35 UTC","updated_at":"2014-10-22 21:52:35 UTC","milestone_id":null,"state":"opened","merge_status":"unchecked","target_project_id":9,"iid":9,"description":"","position":0}}

      When you press "Test Hook" for the merge request, the job builds succesfully and there are no issues, here is the data that gets sent:

      {"before":"2ba2af40719a0b14661b5078d2c709fb7814f16f","after":"d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","ref":"refs/heads/dev_cloud","user_id":14,"user_name":"adam bourg","project_id":9,"repository":

      {"name":"exchange-api","url":"git@gitlab01.localhost.com:exchange/exchange-api.git","description":"","homepage":"http://gitlab01.localhost.com/exchange/exchange-api"}

      ,"commits":[{"id":"d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","message":"Merge branch 'dev_cloud' of localhost.com:exchange-api into dev_cloud","timestamp":"2014-10-14T15:53:34-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/d27f6559cc4c4a0b4e76a00c21f6848169e1d5ab","author":{"name":"Adam","email":"Adam@localhost.com"}},{"id":"ef9eba1cc80b1ca7c9178ee2e6c35908a459b5ea","message":"Merge branch 'qa' into dev_cloud","timestamp":"2014-10-14T15:53:26-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/ef9eba1cc80b1ca7c9178ee2e6c35908a459b5ea","author":{"name":"Adam","email":"Adam@localhost.com"}},{"id":"2ba2af40719a0b14661b5078d2c709fb7814f16f","message":"US3425: recommender_drug needs plan_id in calculate_listed_pharmacy_cost","timestamp":"2014-10-14T15:53:12-06:00","url":"http://gitlab01.localhost.com/exchange/exchange-api/commit/2ba2af40719a0b14661b5078d2c709fb7814f16f","author":{"name":"Adam","email":"Adam@localhost.com"}}],"total_commits_count":3}

      Why is the real merge request trigger sending so little data? How can I fix this and get Jenkins to build Correctly for this job?

      Jenkins version: 1.584

      Gitlab Hook Plugin Version: 1.1.0

        Attachments

          Issue Links

            Activity

            Hide
            jwittner Josh Wittner added a comment -

            I'm having issues getting this to work with my setup as I don't believe the merge requests are compared against the repo url if they're using http. I don't have the ability to use SSH right now so none of my projects, which work fine for build triggered by commit, can be recognized by the merge request payload processor. Looking through the code it looks like the merge repo url is compared against the ssh url, but with the commit it uses the project service and does a more elaborate comparison.

            If that's correct, would it be ok to reopen this bug in hopes of getting http project repo urls detected?

            Show
            jwittner Josh Wittner added a comment - I'm having issues getting this to work with my setup as I don't believe the merge requests are compared against the repo url if they're using http. I don't have the ability to use SSH right now so none of my projects, which work fine for build triggered by commit, can be recognized by the merge request payload processor. Looking through the code it looks like the merge repo url is compared against the ssh url, but with the commit it uses the project service and does a more elaborate comparison. If that's correct, would it be ok to reopen this bug in hopes of getting http project repo urls detected?
            Hide
            jwittner Josh Wittner added a comment -

            See my previous comment. My issue matches the title of this bug, but not exactly the description.

            Show
            jwittner Josh Wittner added a comment - See my previous comment. My issue matches the title of this bug, but not exactly the description.
            Hide
            javiplx Javier Palacios added a comment -

            I've opened an issue specific for http repositories

            Show
            javiplx Javier Palacios added a comment - I've opened an issue specific for http repositories
            Hide
            javiplx Javier Palacios added a comment -

            I've started looking at this, and plugin should be able to trigger also jobs with https urls. Might it happen that your url are a bit more complex than standard ones? Something don't matching https://server/group/repository.git

            Show
            javiplx Javier Palacios added a comment - I've started looking at this, and plugin should be able to trigger also jobs with https urls. Might it happen that your url are a bit more complex than standard ones? Something don't matching https://server/group/repository.git
            Hide
            javiplx Javier Palacios added a comment -

            Josh Wittner, there was a change in payloads which makes the plugin to confuse merge request and standard pushes, and that was likely the cause of your issue. It should be solved in current snapshot from http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/ruby-plugins/gitlab-hook/1.4.2-SNAPSHOT/

            Show
            javiplx Javier Palacios added a comment - Josh Wittner , there was a change in payloads which makes the plugin to confuse merge request and standard pushes, and that was likely the cause of your issue. It should be solved in current snapshot from http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/ruby-plugins/gitlab-hook/1.4.2-SNAPSHOT/

              People

              • Assignee:
                javiplx Javier Palacios
                Reporter:
                adambourg adam bourg
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: