Building a particular revision in Jenkins Pipeline

Sachin Kainth picture Sachin Kainth · Sep 12, 2012 · Viewed 11.8k times · Source

I am using SVN as my source control repository and Jenkins as my CI tool. I run MSBuild scripts using Jenkins to do the actual builds and deploys. I also use the Jenkins Pipeline plugin to do manage the building of downstream projects.

I have an issue with the pipeline. The problem is that, say I have done 10 check-ins into SVN and as a result 10 automatic CI builds have taken place, and as a result of that the pipeline shows 10 builds. Now, if I want to push build number 5 to the next stage in the pipeline I would expect all the code up to the fifth build to be built to the next stage, instead what is happening is that the latest code (build 10) is being used all the time.

I don't know whether I need to modify my build script or whether I need to configure Jenkins or whether I need to configure the pipeline plugin. Does anyone know?

Just in case you don't know what I mean by the pipeline plugin, here is a screenshot.

enter image description here

Answer

cringe picture cringe · Jan 3, 2013

You can add @1234 to your SVN_URL in the SVN location. (see https://stackoverflow.com/a/2325478/834)

You can also use the environment variable SVN_REVISION to get the revision and use something like @${SVN_REVISION} in your SVN location. Documentation is available at https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables.