jenkins-gitlab-merge-request-builder-plugin
jenkins-gitlab-merge-request-builder-plugin copied to clipboard
Jenkins job doesn't start when merge request is submitted in Gitlab
Hello,
I'm trying to use this merge request builder plugin, however it's not working out. I believe I've followed the instructions on ReadMe file properly, but it's still not working. That's why I'm writing to check where I've made mistakes.
First, here are the version number of the systems/plugins I'm working with.
GitLab: 8.2.2 Jenkins: 1.638 Jenkins Plugins: Git plugin: 2.4.0 GitLab Merge Request Builder: 1.2.4
I've cofigured the Jenkins job according to the instructions, and the GitLab web-hook is setup to kick in upon push and merge request sbumit event. But when I create a merge request in GitLab, nothing happens on Jenkins side. I've waited for the scheduled time set by crontab field, but still no build kicks in.
How are the values of ${gitlabSourceRepository} and other variables being passed from GitLab? Is this supposed be in the web-hook that is supposed to kick in? I'm a newbie to this region. Apologize if I've overlooked some things already. Appreciate your help. If you need any more info, please let me know.
Thanks,
The plugin was working for me until I upgraded Gitlab to 8.2.
GitLab: 8.2.2 Jenkins: 1.641 Jenkins Plugins: Git plugin: 2.4.0 GitLab Merge Request Builder: 1.2.4
@amimas GitLab Merge Request Builder 1.2.4 does not support web-hooks. You must configure it using the original setup, which will use polling to detect changes. Once version 2.x is released it will support web-hooks.
@danhooper What version of Gitlab was it working on?
I was using 8.0 previously
me too, nothing happen when i create a merge request in Gitlab
Gitlab: 8.1.4
Jenkins:1.639
Git plugin: 2.4.0
GitLab Merge Request Builder: 1.2.4
Software | Working | Not Working |
---|---|---|
GitLab | 7.12 | 8.2.2 |
Jenkins | 1.609.2 | 1.625.2 |
Git Plugin | 2.4.0 | 2.4.0 |
GitLab Merge Request Builder | 1.2.2 | 1.2.2, 1.2.4 |
I started experiencing this issue after I updated both Jenkins and GitLab.
I unfortunately cannot roll back either my Jenkins or GitLab instances to determine which change caused the issue.
The only relevant error I can see is from the BuildTrigger. I am happy to provide more logs and information.
org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for com.cloudbees.plugins.flow.BuildFlow@2984066c[foo-build-job]
java.lang.NullPointerException
at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:100)
at hudson.triggers.Trigger.checkTriggers(Trigger.java:268)
at hudson.triggers.Trigger$Cron.doRun(Trigger.java:217)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Okay, so I just did the upgrade path 7.13 -> 8.0.0 -> 8.2.3 and had it successfully work on each. Are you guys using the assignee filter, or perhaps its not blank and that is causing your issue?
@NeuralSandwich That issue must have been when you were still on version 1.2.2 because the NPE couldn't have happened on that line in 1.2.4.
@ajohnson-ventera Yeah, your right that error is from 1.2.2, I downgraded the plugin on my Jenkins instance.
Which version of Jenkins did you test this on?
1.642, which is the latest
I have upgrade the plugin back to 1.2.4
This is the error I am getting, I have assignee set to an empty string.
org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run() failed for com.cloudbees.plugins.flow.BuildFlow@77fd7db6[foo-project]
java.lang.NullPointerException
at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.assigneeFilterMatch(GitlabMergeRequestWrapper.java:169)
at org.jenkinsci.plugins.gitlab.GitlabMergeRequestWrapper.check(GitlabMergeRequestWrapper.java:125)
at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:83)
at org.jenkinsci.plugins.gitlab.GitlabRepository.check(GitlabRepository.java:65)
at org.jenkinsci.plugins.gitlab.GitlabMergeRequestBuilder.run(GitlabMergeRequestBuilder.java:27)
at org.jenkinsci.plugins.gitlab.GitlabBuildTrigger.run(GitlabBuildTrigger.java:129)
at hudson.triggers.Trigger.checkTriggers(Trigger.java:268)
at hudson.triggers.Trigger$Cron.doRun(Trigger.java:217)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
@NeuralSandwich That is interesting. Because I've set mine to an empty string. Did you set it before you upgraded or after?
of course this is moot if it was version 2.0
It was set to jenkins when it upgrade (default from the username I guess) then I set it to empty so it would trigger for any commit. I am testing again a merge request assigned to jenkins right now, just waiting for it to trigger.
What do you mean by version 2.0?
There are several changes in the master for this plugin, but @timols hasn't done a release for it.
You could also compile the master version and install it in your jenkins yourself
1.2.4 is working!
Not 100% sure what was going on but I have updated some jobs which used the plugin to have the assignee set to an empty string and they have started working.
I think initially the API token got reset somehow (connection refused in older logs), I didn't see this until now. Reverting to 1.2.2 didn't work with the new jenkins. Now back on 1.2.4, connection issue resolved and the assignee reset on job things seem to be working.
Thank you for your help @ajohnson-ventera!
For those suffering this issue I hope this list might help you debug things:
- Check Jenkins configure for API token (potentially just re-add it incase)
- Check default and per job assignee
- Check merge request is set to the user Jenkins is using
@NeuralSandwich I have the following:
Software | Version |
---|---|
GitLab | 7.13.4 |
Git Plugin | 2.4.0 |
Gitlab Merge Request Builder | 1.2.4 |
Jenkins | 1.625.3 |
[x] Jenkins API token added
I have a merge request where jenkinsci user is assigned to it. and in the system settings jenkinsci is the filter same for the job (MultiJob Project).
I don't know what is the correct url that should be used as a webhook on gitlab, so i have the following:
http://jenkins.foo.com/project/my_job_name/gitlab-webhook/start
http://jenkins.foo.com/project/my_job_name/start
both of them when i press on test hook
, i get this result:
Dec 17, 2015 3:10:29 PM com.dabsquared.gitlabjenkins.GitLabWebHook getDynamic
INFO: WebHook called with url: /gitlab-webhook/start
Dec 17, 2015 3:10:29 PM com.dabsquared.gitlabjenkins.GitLabWebHook getDynamic
INFO: WebHook called with url: /start
Dec 17, 2015 3:10:29 PM com.dabsquared.gitlabjenkins.GitLabWebHook getDynamic
WARNING: Dynamic request mot met: First path: 'gitlab-webhook' late path: 'start'
Dec 17, 2015 3:10:29 PM com.dabsquared.gitlabjenkins.GitLabWebHook getDynamic
WARNING: Dynamic request mot met: First path: 'start' late path: 'start'
And no build triggered, I have to wait until the cron starting to check in order to build it.
What should I do in order to make it work correctly as soon as merge occured ?
Thanks for your help
@mostafahussein web hooks will not work with your current version of the plugin.
OK. Should I downgrade ? And which url is the correct one ?
Neither of those will work in the future version of this plugin. I'm not sure if you're using a different gitlab webhook plugin as well which I can't provide support for.
Until there is another release, this plugin does not support webhooks. The only other way to get it is to clone this repo and build it locally.
@ajohnson-ventera So what to use instead of webhooks? The README says to set it up using a webhook.
@jhasse 1) the release of version 2.0 supports webhooks now, with some minor bugs though; 2) by default the plugin queries the gitlab repository periodically, so even if you are not to configure the webhooks, it should never miss the pending MRs.
@runsisi The release of version 2.0 is not pooling the gitlab repository. Only works with webhooks.
@emsouza it polls as previous releases:)