James Moger
2012-06-06 94dcbd617f3d06ca294d5d151390698e4bddd2cc
groovy/jenkins.groovy
@@ -46,12 +46,16 @@
 * exception handler so it will not crash another script nor crash Gitblit.
 * 
 * Bound Variables:
 *  gitblit      Gitblit Server          com.gitblit.GitBlit
 *  repository   Gitblit Repository      com.gitblit.models.RepositoryModel
 *  user      Gitblit User         com.gitblit.models.UserModel
 *  commands   JGit commands          Collection<org.eclipse.jgit.transport.ReceiveCommand>
 *   url         Base url for Gitblit   String
 *  logger      Logger instance         org.slf4j.Logger
 *  gitblit         Gitblit Server             com.gitblit.GitBlit
 *  repository      Gitblit Repository         com.gitblit.models.RepositoryModel
 *  user         Gitblit User            com.gitblit.models.UserModel
 *  commands      JGit commands             Collection<org.eclipse.jgit.transport.ReceiveCommand>
 *   url            Base url for Gitblit      String
 *  logger         Logs messages to Gitblit    org.slf4j.Logger
 *  clientLogger   Logs messages to Git client   com.gitblit.utils.ClientLogger
 *
 * Accessing Gitblit Custom Fields:
 *   def myCustomField = repository.customFields.myCustomField
 *  
 */
// Indicate we have started the script
@@ -62,10 +66,10 @@
// define your jenkins url here or set groovy.jenkinsServer in 
// gitblit.properties or web.xml
def jenkinsUrl = gitblit.getString("groovy.jenkinsServer", "http://yourserver/jenkins")
def jenkinsUrl = gitblit.getString('groovy.jenkinsServer', 'http://yourserver/jenkins')
// define the trigger url
def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + url + "/git/" + repository.name
def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=$url/git/$repository.name"
// trigger the build
new URL(triggerUrl).getContent()