On Mon, 2016-09-19 at 22:50 +0300, Robert Munteanu wrote:
> I want to use the Job DSL plugin to define a large number of jobs
> programatically, rather than maintain them by hand.

Here's a quick sample of how I intend to use the DSL plugin. 

First, I create a 'seed' job, in charge of generating other jobs.

Then, I use the following script:

def svnBase = "https://svn.apache.org/repos/asf/sling/trunk";
def modules = ["bundles/extensions/i18n", "contrib/extensions/sling-

modules.each {
    def svnDir = svnBase +"/" + it
    def jobName = "sling-" + it.replaceAll('/', '-')

    job(jobName) {
        scm {
        triggers {
            scm('H/15 * * * *')
        steps {
            maven {
               mavenInstallation("Maven 3.3.9") 

This configures two jobs with identical settings. Of course, in the
future we can configure all jobs this way, and the script will be
stored in SVN.

Another benefit is that if a contributor wants to reproduce a problem
on Jenkins, all the effort that is required is to run Jenkins via
docker, install a couple of plugins, create the seed job and all the
Jenkins configuration is replicated.


Reply via email to