How to create a Job automatically using Seed Jenkins plugin and Job DSL script

How it works ?

Create a Freestyle Job called Seed Job and define the Job DSL script.

In the Seed JOb use the Process Job DSLs step to execute the Job DSL script to create a required job with all necessary configurations.

Job DSL script can be defined in two ways:

Job DSL script is a groovy script which uses the Job DSL plugin to define the structure.

Job DSL script Reference:



Creating Seed Job by declaring Job DSL script in Job itself

From Jenkins dashboard click on New Item create one Freeststyle project named Seed JOb

def gitUrl = ""

job("MyProject-Build") {
    description "Builds MyProject from master branch."
    parameters {
        stringParam('COMMIT', 'HEAD', 'Commit to build')
    scm {
        git {
            remote {
                url gitUrl.
                branch "origin/master"
            extensions {
                localBranch master
    steps {
        shell "Look: I'm building master!"