I have reviewed the resulting "Questions that may already have your answer" as well as many variations of a google search. 2 scenarios were found that used a different solution, which does not meet our needs. -Build from trunk or branches' - SVN URL variables The end result I am trying to achieve is a single job that monitors a specific project under all branches. For instance, a checkin to svn://svn.host/branches/*/project/code/place would trigger a build. I have tried to wildcard the svn URL as such with regular expressions and continue to receive notification the the URL is invalid. Has anyone been able to configure a single Jenkins job that monitors a specific directory under multiple branches? Thanks in advance for any assistance.
Asked
Active
Viewed 861 times
1 Answers
0
If you have a finite set of branches you wish to monitor then you define them all separately with the 'Add more locations' button in the SVN configuration.
If you have a more complex configuration then you could achieve this by having a job to reconfigure your main job using Job DSL Plugin which allows jobs to be reconfigured with groovy
def branches
"svn ls svn://XXX/branches/".execute().with { br ->
branches = text.split()
br.waitFor()
}
job{
using "__xxxxx" //important or it replaces job with only svn entries
name "__xxxxx"
scm{
svn( 'svn://XXX/trunk/a/bit/deeper', 'trunk')
{
branches.each(){ br ->
it / locations << 'hudson.scm.SubversionSCM_-ModuleLocation' {
remote "svn://XXX/branches/${br}/a/bit/deeper"
local "${br}"
}
}
}
}
}

KeepCalmAndCarryOn
- 8,817
- 2
- 32
- 47
-
That would work for a finite set of branches, thanks. However, we do continue to increment the branches, so would not work in our situation. Still trying to find a good solution. – user2774337 Sep 19 '13 at 20:51
-
you can run the groovy code in a separate job and it will add (and remove) svn settings to the main job as the branches change – KeepCalmAndCarryOn Sep 19 '13 at 22:01