Is it possible to parameterize a Subversion "Repository URL" location in a Jenkins build job configuration?

7,827 views
Skip to first unread message

Linley

unread,
Apr 24, 2012, 9:46:27 AM4/24/12
to Jenkins Users
Hi,

We have a SVN structure that consists of a main "parent" directory
which has sub-folders for each deployable project (which happen to be
Maven Java projects). Underneath these sub-folders are the SVN
branches, tags & trunk folders where the Maven Java project code
exists. For example:

http://jira/svn/JiraProject [Main parent directory]
|
|--->ProjectA
| |--->branches
| |--->tags
| |--->trunk
| |--->maven-module
| |--->pom.xml
|
|--->ProjectB
| |--->branches
| |--->tags
| |--->trunk
| |--->maven-module
| |--->pom.xml
|
|--->etc...

Currently, we have separate Jenkins jobs for each project (i.e.
Project A, Project B, etc) which checks out the code from the
Subversion trunk directory of the specific project (e.g.
http://jira/svn/JiraProject/ProjectA/trunk), builds it using a Maven
profile and triggers another Jenkins job to deploy to an environment.

However, we are going to have a considerable number of these "child"
projects, so I was wondering if it is possible to have one "generic"
Jenkins build job rather than separate ones for each project (i.e.
ProjectA, ProjectB, etc)?

If so, how do you parameterize the SVN "Repository URL" (e.g.
http://jira/svn/JiraProject/${project}/trunk, where ${project} can be
passed as a parameter at runtime)?

Thanks

طلال Anthony رابعة

unread,
Apr 24, 2012, 8:09:35 PM4/24/12
to jenkins...@googlegroups.com
Hello,

I'm doing something similar to that. I have a parent project that polls SVN. When it detects a change, it performs it job then uses the parameterized trigger plugin to call on over 20 other jobs. I pass $SVN_URL_PREFIX as a parameter and use a shell to do checkouts. The parameter is defaulted to trunk in each child job.

Anthony

Maven User

unread,
Apr 25, 2012, 9:52:08 AM4/25/12
to jenkins...@googlegroups.com
Have you tried global environment variables?

Jenkins has so much intelligence built into polling, seems like a shame to ditch that for some quicky hand-rolled script :-/

mark_kendzior

unread,
Apr 25, 2012, 1:37:42 PM4/25/12
to Jenkins Users
Linley,
Yes, you can do exactly what you said. I am doing that exact thing.

Add a String pramater to the build job. In my case I use branch as
the parameter name.
In the SVN URL put something like this: https://my-svn.com/branches/${branch}

The SVN plugin will expand the ${branch} parameter for you.

Mark
> > Thanks- Hide quoted text -
>
> - Show quoted text -

Maven User

unread,
Apr 25, 2012, 3:23:44 PM4/25/12
to jenkins...@googlegroups.com
Problem becomes - what happens if there are 30 jobs that need that same property?

Parameters are great if you want to click build, not so hot for polling based things (or use default value I guess).

karthikeyan devarajan

unread,
Aug 22, 2015, 4:03:03 AM8/22/15
to Jenkins Users
Hi Mark,

I tried the same. but jenkins job is not passing the value to the parameter. My svn url is: http://KarthikDev-PC/svn/Sample/branches/SpringExample-${Branch-Version}
i can see error message under svn url: "/branches/SpringExample-$Branch-Version" doesn't exist in the repository. Maybe you meant "/branches/SpringExample-1.0.0"?

Thanks,
Karthik

moodysma sma

unread,
Aug 22, 2015, 8:44:22 AM8/22/15
to Jenkins Users, linley...@googlemail.com
Try this example, worked for me.  Don't see why it can't be modified to use SVN:

Ricardo García Fernández

unread,
Aug 31, 2015, 6:50:05 AM8/31/15
to Jenkins Users, linley...@googlemail.com
Hi!

Using Parametrized trigger plugin with choice parameter to select a project inside (only string name).
You have to include every module manually.
And configure url using parameter name in SVN Repository properties:

You can try to use to automate info from repository and branchs/tags/trunk folders:

I hope it helps!
Ricardo.
Reply all
Reply to author
Forward
0 new messages