0

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>
Leela Addagulla
  • 181
  • 1
  • 1
  • 10
  • What's the purpose of creating a branch after a build? Usually, when I get a request like this, I have a feeling the site might be doing something that could be done a better way. For example, one site wanted to do this because they wanted to be able to _merge_ individual changes to other branches. They didn't realize that you could do _cherry picking_ merges in Subversion, so there was no need for each commit to be on a separate branch. – David W. Aug 19 '14 at 14:27

1 Answers1

0

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>
Slav
  • 27,057
  • 11
  • 80
  • 104