diff options
author | Tino Desjardins <tino.desjardins@arcor.de> | 2022-09-03 08:45:36 +0200 |
---|---|---|
committer | Tino Desjardins <tino.desjardins@arcor.de> | 2022-09-03 08:45:36 +0200 |
commit | 8e428360979a7c0e0b189370bd2b37ccb89e022d (patch) | |
tree | 482fe00dd590b3db91e3edef1e998a86995a3d45 | |
parent | 541472fe1d74130d8f0105331a1d16c07c676027 (diff) | |
download | gitblit-8e428360979a7c0e0b189370bd2b37ccb89e022d.tar.gz gitblit-8e428360979a7c0e0b189370bd2b37ccb89e022d.zip |
Add support for Jenkins access token fixes #1423
-rw-r--r-- | src/main/distrib/data/groovy/jenkins.groovy | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/distrib/data/groovy/jenkins.groovy b/src/main/distrib/data/groovy/jenkins.groovy index f029b26a..7f88eb90 100644 --- a/src/main/distrib/data/groovy/jenkins.groovy +++ b/src/main/distrib/data/groovy/jenkins.groovy @@ -69,11 +69,15 @@ 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 your jenkins access token here or set groovy.jenkinsToken in
+// gitblit.properties or web.xml (https://github.com/jenkinsci/git-plugin/#push-notification-from-repository)
+def jenkinsToken = gitblit.getString('groovy.jenkinsToken', 'yourtoken')
+
// define the repository base url
def jenkinsGitbaseurl = gitblit.getString('groovy.jenkinsGitbaseurl', "${url}/r")
// define the trigger url
-def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}"
+def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}" + "&token=" + jenkinsToken
// trigger the build
new URL(triggerUrl).getContent()
|