I have a couple of servers:
- Jenkins
- Gitlab
On gitlab, I have a webhook:
On Push events -> http://{jenkinsIP}:8080/gitlab/build_now
On Jenkins, I have a job:
Source Code Management:
Git:
Repository URL : git@{GitlabIP}:{Gitlabgroup}/{project}.git (copy from gitlab)
Credential: key-pair working
Branches to build: */master
Repository browser: gitlab
url: http://{GitlabIP}/{Gitlabgroup}/{project}
Version: 6.5.1
Poll SCM
Schedule H/1 * * * *
Any clue why Jenkins isn't running the job?
On Jenkins, you should disable "Poll SCM"
and set the "Branches to build"
to "master"
(not "*/master"
)
You don't have to put a schedule in the "poll SCM" box, it's enough to enable this option. (even if jenkins warns you (yellow), that nothing will ever happen). Then, the webhook at gitlab does his job.
I configured my stuff following http://juristr.com/blog/2014/01/git-flow-jenkins-gitlab/ and it works
There could be multiple problems.
For one, I don't see why you create a WebHook on Gitlab, and use Poll SCM on Jenkins: either use Trigger builds remotely on Jenkins with a WebHook on Gitlab, or Poll SCM on Jenkins but then also enable some Credentials for the git repo on Jenkins' side (most probably SSH deploy key).
Other than that, builds are actually triggered if the git repo changes: what branches are configured on Jenkins' side ?
Note, I haven't tested the Gitlab plugin for Jenkins yet.
The GitLab plugin is awesome. Follow the instructions and everything works like a charm. It is also described how to send back information to GitLab from jenkins: https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example. I faced problems with the GitLab webhook to jenkins due to https connection (500 error). I fixed it including the SSL cert in the GitLab server: https://gitlab.com/gitlab-org/gitlab-ce/issues/2681