0

I've read many posts here and already setup a Jenkins and SVN integrated system in Linux, and run some builds. I have a background of IBM Rational tools with ClearCase(SVN) and BuildForge(Jenkins).

With IBM tools, before the build, we make a baseline in ClearCase to identify the code to build, rebase the child stream/branch to get the baselined code base into the build system so it won't change during the build.

With SVN/Jenkins, how to achieve the same? Let's say we are build the code on trunk. Jenkins loads the code base from trunk to its build workspace and run the build on it. The code on trunk will change during the build. How to identify the code base in SVN has been built?

Thanks Jirong

user2784896
  • 309
  • 1
  • 5
  • 13

1 Answers1

0

With Subversion, Jenkins will check out the most recent revision of the trunk at the start of the build. New commits during the build won't show up in Jenkins workspace (unless your build script does a svn update, of course).

Obviously you want to keep track of this revision number. Jenkins does this already in the build log, but you can also use:

  • The environment variable SVN_REVISION is set to the revision number. Your build script can make us of it to for example embed it into artifacts.
  • The Subversion Tagging Plugin can automatically make a tag for successful builds.
Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • In Jenkins, I see the following choices, which one shall I use? 1. Use 'svn update' as much as possible. 2. Use 'svn update' as much as possible, with 'svn revert' before update. 3. Emulate clean checkout by first deleting unversioned/ignored files, then 'svn update'. 4. Always check out a fresh copy. – user2784896 Nov 20 '13 at 20:16
  • How to use SVN tags? The tag is not tagged on the original files, then how to find the files by tags? – user2784896 Nov 20 '13 at 20:21
  • I'd start with *4. Always check out a fresh copy*. If that takes too long time, try out the alternatives. SVN tags are "copies" of a repository tree at a specific revision. It is common to store them in the `tags/` folder (one the same level as `trunk/` and `branches/`). If you are new to subversion, I suggest you skim [The SVN Book](http://svnbook.red-bean.com/en/1.7/index.html), at least the [Tags](http://svnbook.red-bean.com/en/1.7/svn.branchmerge.tags.html) chapter. – Anders Lindahl Nov 21 '13 at 06:42
  • [This answer](http://stackoverflow.com/questions/8692411/svn-for-clearcase-user-how-to-use) explains the difference between a clearcase baseline and a subversion tag. – Anders Lindahl Nov 21 '13 at 07:14
  • I've read all the references you pointed out, also installed the svn-tag plugin. It creates a new tag after a successful build. So now I am trying to figure out the exact build process in Jenkins. Step1: Checkout the code from the trunk and run the build against it. Step2: Create a tag after a successful build using svn-tag plugin. Step3: generate the change list of file using "svn -diff" between two tags. Is this right? – user2784896 Nov 27 '13 at 18:54
  • I cannot really say if that is "right" or not, as that depends on the requirement from your organization/customer. However, step 1 and 2 is a sensible build process, and it will give you all the data needed to be able to compute the change list in step 3. – Anders Lindahl Nov 28 '13 at 06:54