Git Product home page Git Product logo

Comments (5)

elvanja avatar elvanja commented on September 23, 2024

I suspect that Gitlab sends a bit different payload when merge request is in question, as opposed to payload for a regular commit. Can you provide the exact payload?

from jenkins-gitlab-hook-plugin.

xaniasd avatar xaniasd commented on September 23, 2024

According to the api that's correct. This is what GitLab sends (also in line with what I receive as payload).

Merge request events

Triggered when a new merge request is created or an existing merge request was updated/merged/closed.

Request body:

{
  "object_kind": "merge_request",
  "object_attributes": {
    "id": 99,
    "target_branch": "master",
    "source_branch": "ms-viewport",
    "source_project_id": 14,
    "author_id": 51,
    "assignee_id": 6,
    "title": "MS-Viewport",
    "created_at": "2013-12-03T17:23:34Z",
    "updated_at": "2013-12-03T17:23:34Z",
    "st_commits": null,
    "st_diffs": null,
    "milestone_id": null,
    "state": "opened",
    "merge_status": "unchecked",
    "target_project_id": 14,
    "iid": 1,
    "description": ""
  }
}

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

OK, so that explains it.
See https://github.com/elvanja/jenkins-gitlab-hook-plugin#hook-data-related, I added an example of Gitlab payload for a commit. You can see that that payload contains data I can use to determine which project is to be built.

One question though. Before merge request, a commit to feature branch was surely made. And that has undergone a Jenkins build, if all is set correctly. Why would you need to build again for merge request?

from jenkins-gitlab-hook-plugin.

xaniasd avatar xaniasd commented on September 23, 2024

Yes, thanks. So basically the plugin supports only push events now, as there's no trivial way to get the url. That would require reading e.g. a project configuration parameter, as the repo url is configured there (git plugin).

About your question: This job needs quite some time to build so I don't want to trigger it with every commit to a feature branch. Much rather after a MR is opened. The other relevant plugin (Gitlab Merge Request Builder) does that I think, but uses polling.

Anyway, thanks for the reply. If you have a good suggestion, I'm more than happy to hear it :-)

cheers

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Well, I guess that since it's done in mentioned plugin, it is doable. Please try the other plugin, no sense in duplicating behavior if it works :-) Other than that, no suggestions, sorry!

from jenkins-gitlab-hook-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.