From 306116c30db7714ec9011ae2d43addcc6bcdc081 Mon Sep 17 00:00:00 2001 From: rgroux Date: Wed, 16 Dec 2015 13:37:45 +0100 Subject: Change Jenkins groovy script for any protocol (git/http/ssh) groovy.jenkinsGitbaseurl in gitblit.properties or web.xml can override the http default protocol --- src/main/distrib/data/groovy/jenkins.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/distrib/data/groovy/jenkins.groovy b/src/main/distrib/data/groovy/jenkins.groovy index 422b2200..f029b26a 100644 --- a/src/main/distrib/data/groovy/jenkins.groovy +++ b/src/main/distrib/data/groovy/jenkins.groovy @@ -69,8 +69,11 @@ logger.info("jenkins hook triggered by ${user.username} for ${repository.name}") // gitblit.properties or web.xml def jenkinsUrl = gitblit.getString('groovy.jenkinsServer', 'http://yourserver/jenkins') +// define the repository base url +def jenkinsGitbaseurl = gitblit.getString('groovy.jenkinsGitbaseurl', "${url}/r") + // define the trigger url -def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=${url}/r/${repository.name}" +def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}" // trigger the build new URL(triggerUrl).getContent() -- cgit v1.2.3