简体   繁体   中英

Hudson SVN Create Branch from Trunk Revision

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>

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM