]> source.dussan.org Git - gitblit.git/commitdiff
Add support for Jenkins access token fixes #1423 1425/head
authorTino Desjardins <tino.desjardins@arcor.de>
Sat, 3 Sep 2022 06:45:36 +0000 (08:45 +0200)
committerTino Desjardins <tino.desjardins@arcor.de>
Sat, 3 Sep 2022 06:45:36 +0000 (08:45 +0200)
src/main/distrib/data/groovy/jenkins.groovy

index f029b26a1faa5416024dcd763a639f7c76bf521b..7f88eb901978d8c843d215e8287ba9dd790cef46 100644 (file)
@@ -69,11 +69,15 @@ logger.info("jenkins hook triggered by ${user.username} for ${repository.name}")
 // gitblit.properties or web.xml\r
 def jenkinsUrl = gitblit.getString('groovy.jenkinsServer', 'http://yourserver/jenkins')\r
 \r
+// define your jenkins access token here or set groovy.jenkinsToken in \r
+// gitblit.properties or web.xml (https://github.com/jenkinsci/git-plugin/#push-notification-from-repository)\r
+def jenkinsToken = gitblit.getString('groovy.jenkinsToken', 'yourtoken')\r
+\r
 // define the repository base url\r
 def jenkinsGitbaseurl = gitblit.getString('groovy.jenkinsGitbaseurl', "${url}/r")\r
 \r
 // define the trigger url\r
-def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}"\r
+def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}" + "&token=" + jenkinsToken\r
 \r
 // trigger the build\r
 new URL(triggerUrl).getContent()\r