Category Archives: Jenkins

Jenkins Snippets

Wipe out workspaces for all projects: Thanks to Stefan Bäumler at, I made a copy right here. [code language=”groovy”] import hudson.model.* // For each project for(item in Hudson.instance.items) { // check that job is not building if(!item.isBuilding()) { println(“Wiping … Continue reading

Posted in Jenkins, Snippets | Leave a comment

Get Subversion Revision For Workspace in Jenkins

You can use svnkit, a Java interface for Subversion supplied with the Subversion Plugin for Jenkins for getting Subversion information about jobs and various locations in a Subversion repository. I found that this approach was difficult to use when using … Continue reading

Posted in Jenkins | Tagged | Leave a comment

Tagging A Jenkins Build In Subversion

I have looked at several plugins from which you can tag builds in Jenkins, but I have not quite found the one I wanted. I decided to write a reusable piece of groovy script using the Scriptler plugin. This script … Continue reading

Posted in Jenkins | Tagged | Leave a comment

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 … Continue reading

Posted in Jenkins | Tagged | Leave a comment

Get Environment Variable From Last Jenkins Build

Using Groovy scripting and the Groovy Plugin you can do this: [source gutter=”0″ light=”1″ collapse=”0″ language=”groovy”] def job = Hudson.instance.getJob(‘CoolJob’) def run = job.getLastBuild() println run.getEnvironment()["SVN_REVISION"] [/source] If you just println run.getEnvironment(), you’ll see the whole list of environment variables … Continue reading

Posted in Jenkins | Tagged | 2 Comments

Subversion And Jenkins As A Windows Service

I have recently begun migrating a fully scripted MSBuild build to Jenkins. I am currently running Jenkins as a Windows Service and started off running it under the System account. Downloading projects from Subversion works fine when Jenkins does it … Continue reading

Posted in Jenkins | Tagged | 1 Comment