Subversion URL From Jenkins Job

Using Groovy scripting, here is how you can get the SCM location for the Subversion source code download. This example is for Subversion, so you may want to check this with other tools such as Git, TFS, or Mercurial.

def job = Hudson.instance.getJob('CoolJob')  
job.scm.locations[0]

I got this from the following post: http://jenkins.361315.n4.nabble.com/groovy-script-change-subversion-checkout-url-tp3437354p3441284.html The code from that post is shown below and is great for a future reference.

[groovy gutter=”0″ light=”1″ collapse=”false”]
def hudson = hudson.model.Hudson.instance
def job = hudson.getJob("MyJob")
job.scm.locations.each{ println it } //print current location
job.scm = new hudson.scm.SubversionSCM("http://test")
[/groovy]

Download PDF
This entry was posted in Jenkins and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *