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.

[sourcecode language=”groovy” gutter=”0″ light=”1″ collapse=”false”]
def job = Hudson.instance.getJob('CoolJob')

I got this from the following post: 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")

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 *