Subversion Revision From Repository For Jenkins Dynamic Parameter

We may just want to get the latest Subversion repository itself rather than for a workspace for a dynamic Jenkins job parameter. Using svnkit is difficult in this case as explained in Get Subversion Revision For Workspace in Jenkins. The following can get used in a Scriptler script for a dynamic parameter to get the latest or HEAD revision:

def pSvn = ("svn info -r HEAD $SvnUrl").execute()
def sout = new StringBuffer()
pSvn.consumeProcessOutput(sout, null)        
def currentTags = sout.toString().trim()
def mt = currentTags =~ /Revision\:\s+(\d+)/
return mt[0][1]

Just define SvnUrl as the only parameter and set its value to the proper repository URL when defining the dynamic parameter.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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