Triggering Jenkins builds in GitLab 8

When GitLab CI was integrated into Gitlab 8, it broke our workaround for triggering Jenkins builds on push.

We used to have the GitLab CI service point at our Jenkins server. It would throw JSON (I think) at Jenkins, and the Jenkins GitLab plugin would figure out we wanted to run a build.

Now that CI is integrated, I can no longer set the CI url to our Jenkins url. That means I can’t add Jenkins builds to new projects.

Has anyone figured out a decent workaround to get Jenkins working in GitLab 8?

I’d buy the Enterprise version to get the Jenkins plugin, but I have no budget. And even if my work place could afford it, I’d be out of luck on my personal projects.

Also, I have looked at GitLab CI. I spent a couple days trying to get it to do what I needed, and couldn’t. I spent half a day getting Jenkins working the way I wanted. So, Jenkins won.

You could probably do it using a “Web Hook”. You might need to modify the Jenkins plugin to handle a different message format, but it should be doable.

That is one method I am looking at. Haven’t actually made it work yet…

WebHook works to trigger the build, however you don’t see the result of the build on the merge request page. And there’s no link to take you to the build page. That only worked (perfectly) when you were able to specify custom URL for “Gitlab CI” integration. This is a major problem for me, as we were relying on the integration for code-review process.

Reviewers need to know if build passed, before accepting merge request.

So, what address do you point your webhook at?

Simply the url of your jenkins job that you want to be triggered on merge request. See the documentation for jenkins gitlab plugin.

However since you can’t see result of the build in gitlab this is kinda lame. I think the message here is “upgrade to Enterprise or else”… bummer.

That’s what I tried. It didn’t work.

Then again, I just noticed that the ci section also has web hooks.

So, by web hook, do you mean the gitlab->project->project settings->Web Hooks page, or the gitlab->gitlab-ci->ci-project->Web Hooks page?

Sorry, my bad. it’s actually not simply the job url. I was mistaken as I did it a while ago and it’s easy to mistaken the url for it when looking at it. it should be:

http://<jenkins-host:port>/project/<merge-request-job>/

Note the literal word ‘project’ there, not ‘job’. And I think it only works if you have gitlab plugin installed on jenkins side. And yes it goes under “gitlab->project->settings->WebHooks”

Regards,

I created a git project called jenkinswebhooktest. And a jenkins project called jenkinswebhooktest. Then I pointed the webhook at https://ci.host.name/project/jenkinswebhooktest. When I click the “Test Hook” button, it does not cause the build to run.

I have the gitlab plugin installed on Jenkins. The “Build when a change is pushed to GitLab …” checkbox is checked.

The gitlab plugin is version 1.1.24.

Is there something else in the jenkins side I need to configure? I did try checking the “Trigger builds remotely” box.

Used the gitlab plugin, in jenkins triggers select “Build when a change is pushed to GitLab”. In Gitlab >> webhooks create a new webhook and used as url which it is next to GitLab CI Service URL. Test the webhook and you see that in jenkins the task is build with a message that the build has initiated by Gitlab

Hi,
I am using new GitLab Jenkins integration and missing something obviously.
On Jenkins side I have a pipeline Job not a project.
The GitLab Jenkins CI will call URL /project/ when correct is /job/
Any idea what to do ?
Thanks
Michal