I've had this problem as well.  There are two ways of going about it.

If you're willing to pay money, get the CloudBees Enterprise Edition, which has 
some plugins you can't get for free.  One is a "Template" plugin.  Basically, 
you make the job you want once, copy the XML into the template, and make some 
Groovy or Jelly changes to give the job some parameters.  Once you make a 
template for "build something my way", you can quickly make jobs "build X my 
way" and "build Y my way".

If you don't want to pay money, you can still make something like this.  Write 
a parameterized job ("build stuff my way") that takes the branch name as a 
parameter.  Get the env-inject plugin (for free) and make a job "build X my 
way".  Set up the build trigger as needed.  The configuration of this job goes 
like this:

Build Step 1:  Use an "execute shell" or "execute batch" step to write the 
parameters for "build stuff my way" to write a temporary properties file.  In 
Unix, the shell might look like:

echo BRANCH="stream_X" > /tmp/$BUILD_TAG.properties

Build step 3: "Use builders from another project", specifically, from "build 
stuff my way".  Since you loaded BRANCH as a property, "build stuff my way" 
will see your value of BRANCH.

Post-build step 1: "Use publishers from another project", specifically, from 
"Build stuff my way".

Finally, make a new job, "build Y my way", by copying existing job "build X my 
way".  In the configuration, change from "stream_X" to "stream_Y", change the 
build trigger to match and you're all set.  Lather, rinse, repeat.  Since all 
the logic is in "build stuff my way", the "build X my way" jobs should never 
have to change.

--Rob Mandeville

From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Rob
Sent: Sunday, June 23, 2013 10:25 PM
To: jenkinsci-users@googlegroups.com
Subject: Re: scaling jenkins to multiple projects without copying the projects

Similar questions that I(noob) haven't seen an answer for.  let's say that i 
have one sw project, called X,  running 50 jobs a night that I want to copy to 
project Y.   the source comes from the same repository but on a different 
branch.  I will need to add tests for Y and do not want the Y test results to 
interfere with X.  do I have to copy all the jobs manually (or via script)?  
does jenkins have any provisions for copying an entire project?
Thanks,
Rob

On Friday, August 24, 2012 2:51:29 PM UTC-4, krishna kurnala wrote:
You can try using Jenkins CLI for updating Jobs in Bulk or even even scripting 
interface (your jenkins URL/script

Recommend the following Links:
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console

Thanks,

Thanks,
Krishna Chaitanya

On Fri, Aug 24, 2012 at 11:29 AM, Les Mikesell 
<lesmi...@gmail.com<javascript:>> wrote:
On Fri, Aug 24, 2012 at 10:57 AM, Martin d'Anjou
<martin....@gmail.com<javascript:>> wrote:
> What is the plan to scale up Jenkins to handle a very large number of
> projects?
>
> Right now, I have 3 projects in Jenkins. They all have the same build flow,
> so any improvement or plugin I add to one of them, I manually copy it to the
> other two. As we are about to bring more projects to Jenkins, this manual
> copy and paste will quickly become a burden. Reverting a change that was
> copied by hand to multiple project is also a concern of similar nature.
>
> Has there been any thoughts given to how Jenkins can handle these cases?
>
> For example, could multiple projects inherit from a common template project,
> such that a change to a template would be reflected into multiple projects?
> I see a Template Project plugin, but there has been no activity for a year
> on it.
>
> I have no need to link projects together, so I have stayed away from the
> Workflow plugins. Should I look into them?
Normally the bulk of the work is done by build scripts/Make/project
files that are included in the source checkout and once you have one
or a few jenkins jobs working the way you want, you just tell jenkins
to copy a similar one when creating a new job, then change the
url/path to the different source in your VCS.   There's not a big need
for templates, although it can be cumbersome if you want to change
something in a lot of jobs after they have already been created.

--
   Les Mikesell
     lesmi...@gmail.com<javascript:>

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.


The information in this message is for the intended recipient(s) only and may 
be the proprietary and/or confidential property of Litle & Co., LLC, and thus 
protected from disclosure. If you are not the intended recipient(s), or an 
employee or agent responsible for delivering this message to the intended 
recipient, you are hereby notified that any use, dissemination, distribution or 
copying of this communication is prohibited. If you have received this 
communication in error, please notify Litle & Co. immediately by replying to 
this message and then promptly deleting it and your reply permanently from your 
computer.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to