diff options
author | Florian Zschocke <2362065+flaix@users.noreply.github.com> | 2022-12-09 22:25:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 22:25:12 +0200 |
commit | 83f8ee798f4c3bdc08531464bb762d4b12178e24 (patch) | |
tree | 76e4c8148d1b2e0ffbf17e095011ab0890407ad4 | |
parent | 7031f902f4b9054b87dc5b9e10b10ba0ec470f1d (diff) | |
parent | 8e428360979a7c0e0b189370bd2b37ccb89e022d (diff) | |
download | gitblit-83f8ee798f4c3bdc08531464bb762d4b12178e24.tar.gz gitblit-83f8ee798f4c3bdc08531464bb762d4b12178e24.zip |
Merge pull request #1425 from srp-gmbh/jenkins_access_token
Add support for Jenkins Git plugin 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()
|