Chr__Au
Chr__Au

Reputation: 23

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.

Upvotes: 1

Views: 1936

Answers (2)

James Moger
James Moger

Reputation: 1729

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

Upvotes: 1

If you want to be certain that commands in a shell script execute correctly, you need to give the full path. In bash you can ask this with "type curl". For OS X the script should read (untested)

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

Upvotes: 0

Related Questions