Search code examples
gitjenkinshookgitblit

Jenkins Git hook


I have setup a Jenkins CI (standalone port 8081) git over Ubuntu apt-get and gitblit runs on a Tomcat 7.

On my Server the Git home is not more owned by the git user, it's own by tomcat7 that I can create new Repos with gitblit.

Ich can also push and pull commits. But I can't start the Jenkins build after a commit.

In the 'hooks' directory from the repository I have add a new File called post-receive.

#!/bin/bash
curl http://myserver.de:8081/job/mytestrepo/build?token=aasdfbabfabfibafhbhf

The curl command works if I run it on the shell. But it's not run if git should start it? I don't know what I made wrong.


Solution

  • Gitblit does not support executing native hooks; it supports hooks written in Groovy. Gitblit comes bundled with a Jenkins Groovy hook that you can use to trigger your build.

    https://github.com/gitblit/gitblit/blob/master/src/main/distrib/data/groovy/jenkins.groovy