Jenkins and Gitlab: Webhook not working

I have several servers:

  • Jenkins
  • Gitlab

In gitlab, I have a webhook:

On Push events -> http://{jenkinsIP}:8080/gitlab/build_now 

In Jenkins, I have a job:

Source Code Management:

Git:

 Repository URL : git@{GitlabIP}:{Gitlabgroup}/{project}.git (copy from gitlab) 

Credentials: Key Management

Branches for assembly: * / master

Storage Browser: gitlab

 url: http://{GitlabIP}/{Gitlabgroup}/{project} 

Version: 6.5.1

SCM poll

 Schedule H/1 * * * * 

Any clue why jenkins is not working?

+8
git gitlab continuous-integration jenkins
source share
4 answers

In Jenkins, you should disable "Poll SCM" and set "Branches to build" to "master" (not "*/master" )

+11
source share

You do not need to specify a schedule in the "SCM poll" field, it is enough to enable this option. (even if Jenkins warns you (yellow) that nothing will ever happen). Then the webhook in gitlab does its job. I set up my stuff after http://juristr.com/blog/2014/01/git-flow-jenkins-gitlab/ and it works

+1
source share

There may be several problems.

First, I don’t understand why you create a WebHook on Gitlab and use Poll SCM for Jenkins: either use Trigger builds remotely on Jenkins using WebHook on Gitlab, or Poll SCM on Jenkins, but then also include some credentials for the git repository on the Jenkins side (most likely the SSH deployment key).

In addition, assemblies actually start if the git repo changes: what branches are configured on the Jenkins side?

Notice, I have not tested the Gitlab plugin for Jenkins yet.

0
source share

The GitLab plugin is awesome. Follow the instructions and everything works like a charm. It also describes how to send back information to GitLab from jenkins: https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example . I ran into problems with the GitLab website for jenkins due to https connection (error 500). I fixed it, including the SSL certificate on the GitLab server: https://gitlab.com/gitlab-org/gitlab-ce/issues/2681

0
source share

All Articles