Access to the POST Body

20 views
Skip to first unread message

Justin Paston-Cooper

unread,
Mar 12, 2015, 5:00:02 AM3/12/15
to jenkin...@googlegroups.com
Hello,

Gitlab can be configured to have "web hooks" which POST JSON data describing merge requests to chosen URLs. In my case, I would like to have a single Jenkins job to POST to, which would handle all merge requests.

After extensive searching, I have been unable to find a plugin which is able to read POST body (and preferably the headers). It doesn't seem possible to configure Gitlab to pass the data as a URL parameter. Is there a specific reason why there is no such plugin? Is there an alternative?

Thanks,

Justin Paston-Cooper

Javier Palacios

unread,
Mar 13, 2015, 8:00:48 AM3/13/15
to jenkin...@googlegroups.com

On Thu, Mar 12, 2015 at 9:59 AM, Justin Paston-Cooper <paston...@gmail.com> wrote:
Hello,After extensive searching, I have been unable to find a plugin which is able to read POST body (and preferably the headers). It doesn't seem possible to configure Gitlab to pass the data as a URL parameter. Is there a specific reason why there is no such plugin? Is there an alternative?

I'm not sure whether I understand what you want, but as far as I know, there is a plugin specifically targeted to gitlab merge request. And the gitlab-hook plugin, on its current snapshot (1.4.0) should handle merge requests, although I still need to adjust some things before release. But the master branch from my fork (javiplx/jenkins-gitlab-hook-plugin) is the code we use in our jenkins and does work.

Javier Palacios

Christopher Orr

unread,
Mar 16, 2015, 4:24:46 PM3/16/15
to jenkin...@googlegroups.com
The GitHub webhook handler demonstrates some of this stuff:
https://github.com/jenkinsci/github-plugin/blob/27a9d6f/src/main/java/com/cloudbees/jenkins/GitHubWebHook.java#L155-L167

If you want to read the POST body, as opposed to a form variable (as the
GitHub plugin is doing), you can call req.getInputStream().

Regards,
Chris
> --
> You received this message because you are subscribed to the Google
> Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jenkinsci-de...@googlegroups.com
> <mailto:jenkinsci-de...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/CAEndGgQ6hoX7z2VQndHw1mydgsvzgbXMqvksxEEKbtSZh_EWRQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CAEndGgQ6hoX7z2VQndHw1mydgsvzgbXMqvksxEEKbtSZh_EWRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages