Hudson SVN Create Branch from Trunk Revision

427 Views Asked by At

I am trying to create a Hudson Job that does the following.

Check out Code from trunk, Compile. If Compilation is successful, create a branch and copy from Trunk to Branch. Create war with the checkout code and deploy it in container.

My problem here, after the hudson checks out the code and compiles it, I am again saying copy from trunk to branch. During the Compilation time, if there are new check-ins into trunk, My war file and the branch will not be in sync, as the new check-ins are included in the branch, but not in my war.

How do I copy that particular revision of trunk into the brach, that is checked out by the hudson.

I see that we could do it by

svn copy trunkUrl@{revision} branchurl

But how do I pass the "hudson checked out version" as parameter to svn copy dynamically.

Is it stored in some variable by Hudson.

This is my build target right now

<svn javahl="false" svnkit="false" username="${username}" password="${password}">
   <copy srcUrl="${src.url}" destUrl="${dest.url}" message="${svn.branch.message}"/>                       
</svn>
1

There are 1 best solutions below

0
On

The SVN revision for module 1 (under Jenkins configuration) is available as environment variable SVN_REVISION_1 (btw, so is the SVN URL as SVN_URL_1)

To access environment variables in ANT, you've got to do this:

<property environment="env"/>
<echo>${env.SVN_REVISION_1}</echo>