Jenkins Coordinator Plugin

19 / Jun / 2015 by Gunjan Sawhney 5 comments

There are many occasions when we require our jenkins jobs to be executed in a predefined order. Jenkins Coordinator Plugin can help us achieve that.

This post will walk you through how to use this plugin to run your jobs  in a particular sequence.

Suppose we have four jobs :  Job1, Job2 ,Job3, Job4. We would like to execute Job1 and Job2 sequentially and Job3 and Job4 in parallel. We can also use this plugin to run our parametrized jobs, which will get clear as we will move further.

Lets begin by making Job1.

Step 1: Create a new freestyle job as shown below:

job11

Step 2: Choose “This build is parameterized”  and  then the type of  parameter which you want from the options in the drop down menu. We have chosen “String parameter” option for simplicity.

job13

Step 3: We will be using this parameter value in our job which will be entered by the user. Use “Execute shell” option from the “Build” drop down menu and write an echo command to print it’s value. “Save” this job once done.

job14

job15

Similarly we have made our Job2 with parameter “age” , and non-parametrized Job3 and Job4.

You can download Coordinator Plugin  through “Manage Plugins” option in “Manage Jenkins” tab.

After installing it, make a new coordinator project/job as shown below:

cj

Now under the Coordinator job, make all the parameters as defined in your respective jobs.

cj13

Step1: Under the “Build” section, right-click on “Root” and click on “Create” option from the drop down menu.

cja

Step2: Now to execute Job1 and Job2 sequentially, we have created “sequential” job under which we will be adding them.

cjb

Step3: Choose “create” option after right-clicking on “sequential” and then write the desired job names.

cjd

Step4: Here, we will be defining Job1 and Job2 as shown below :

cjg

cjh

Step5: Now, to run Job3 and Job4 parallely, again right-click on “Root” and create “parallel” job and then add both the jobs under it following the same procedure as mentioned above.

As you can see, the “S” sign on “sequential” signifies the jobs under it will run sequentially, thats by default. To run Job3 and Job4 parallely, right-click on “parallel” and choose “Swtich P” option for the same.

cje

Step6:  After completing, save changes to your job and then click on “Build with parameters” option to execute it.

build

Step7:  Under the “Execution Plan” tab, you can still select which jobs you want to execute and under “Parameters” tab, you can define the value of the parameters which your respective jobs require.

build1

build2

As you can see, in the Console Output, Job2 is triggered after the success of Job1, as they were defined to be executed sequentially. And Job3 and Job4 are executed at the same time, because we defined them to be executed in parallel.

build3

FOUND THIS USEFUL? SHARE IT

comments (5)

  1. Tal

    This is a cool plugin, thank you for it
    Does it create any tokens\env variables i can use in an email template ?
    I wish to send out a table of all jobs and its status with possible link to its build logs

    Reply
  2. Doudourer

    Great nearly what I need !

    But how to do with DSL (instead using jenkins UI) ?

    I would like to describe my coordinator job by using DSL and then build it it by a pipeline for example.

    Thanks in advance

    Reply

Leave a Reply to Mohamed Cancel reply

Your email address will not be published. Required fields are marked *