How to create a Jenkins Seed Job using Job DSL plugin

Pinterest LinkedIn Tumblr

In this guide we are going to learn how to create a jenkins seed job.

A Jenkins seed job is a special job that is used to create other jobs. A jenkins seed job is a normal Jenkins job that runs the Job DSL script; in turn, the script contains instructions that create additional jobs.

Also check:


  • Jenkins server installed and accessible in a URL
  • Access to jenkins
  • Ensure jenkins server has git installed

Table of content

  1. Ensure that git is installed
  2. Setting up the DSL plugin
  3. Creating the seed job

Ensure that git is installed

The dsl groovy scripts that we will execute to create the jobs will be cloned from git. Please ensure that git is installed on your jenkins server. Here is how to install git for the various operating systems.

Rocky Linux/Centos/Alma Linux/RHEL 8

sudo dnf -y install git

Ubuntu/Debian based systems

sudo apt install -y git


sudo zypper in git

Setting up the DSL plugin

The jenkins seed job uses the job-dsl plugin. You have to install it before proceeding.

To install the plugin, Head over to Jenkins Plugin install page here <url>/pluginManager/available then search for job-dsl

Citizix – Jenkins job dsl

Create credential

To clone code from github, we will need to have github credentials.

In your github profile settings, go to Developer Settings -> Personal access tokens then generate new token. Save it somewhere.

Now go to Jenkins, Manage Jenkins -> Manage Credentials. Then go to global Credentials and add new Credential. Create a username and password credentials with the ID that you will use (github-token in my case).

Creating the seed job

With the dsl plugin installed, we can now set up our jenkins job. Basica

Go to New Jenkins job -> Enter job name then click on freestyle project. Click Ok

Citizix – Seed Job new

This is the seed job config:

Citizix create seed job

Using XML

This is the job xml:

<?xml version='1.0' encoding='UTF-8'?>
    <description>Initial Seed Job</description>
    <scm class='hudson.plugins.git.GitSCM'>

To create jenkins job using anible, save the xml as templates/seed-job.xml. Then use this playbook:

- name: Create jenkins creds
  hosts: localhost
  connection: local
  gather_facts: False
    username: admin
    password: SuperStrPass
    ansible_python_interpreter: /usr/local/bin/python
    - name: Create jenkins jobs
        user: "{{ username }}"
        password: "{{ password }}"
        name: Seed-Job
        url: "{{ jenkins_host }}"
        config: "{{ lookup('file', 'templates/seed-job.xml') }}"

Run playbook

ansible-playbook -i hosts.yaml jenkins.yaml -vv


In this guide we managed to set up a seed job in jenkins that can create other jobs.

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment