Here is my dev configuration:
Under Subversion,
- I have my project_X/trunk (with my latest dev),
- I have my project_X/tags (with different releases),
- I am thinking of adding a branch folder.
I am using Jenkins to build my project_X/trunk using an Ant script. My Ant script does many things, it checks-out, compiles, creates the documentation with graphs, runs the unit tests, performs pmd, creates a jar and zips everything.
I would like to be able to use my Ant script on tags or branches (as well as the trunk) for the same Project.
What's the easiest way to do this:
I think it is just a question of checking out the right path to the Subversion repository, Right?
- If I am correct, I should make the path to the Subversion dynamic.
- In my Ant script should my Subversion path be a variable?
- How do I pass the path value from Jenkins' interface?
- Is there a plugin that lets me pass the Subversion path value from Jenkins to the Ant script?
- Or should I just create a new job in Jenkins (with the same script but different path)?
Hope
Thanks in advance for your help,
Best regards,
You should parameterize your build by tag/branch name. The easiest way to do it is to add a parameter (say, SVN_BRANCH_DIR) to your Jenkins job which will have values such as trunk
, branches/branch1
, tags/sometag
.
Now, if you use Jenkins ANT build step that parameter will be passed automatically to your ANT script as a property (by way of ANT -D
option). So you can use ${SVN_BRANCH_DIR}
in it (e.g. svn://myserver/myrepo/${SVN_BRANCH_DIR}
).