Managing Jenkins Job Using DSL scripts !!

TASK-6

So, Today, we will do some upgradation in our task of deploying and managing jenkins over kubernetes (reference to task3).

So, what we do, is now instead of making our jobs manually we will create with help of DSL, groovy scripts. DSL scripts are generally pushed into github by some developers. Now, in jenkins we will create a seed job which will create all the other jobs specified in the groovy script.

For that, first we have to launch our jenkins from our own created image, this part you can see in my deploying and managing jenkins over kubernetes task3(reference to task3). So, let’s move further now we will install JOB_DSL plugin inside jenkins so that our seed job containing groovy scripts can be run.

After this, we’ll create seed job like this:-

So our DSL groovy script is here (reference to groovy script)

This seed job have created two jobs for us Job 1 and Job 2 and one build pipeline view:-

Job 1-

You can see Job 1 has been created by seed job.
After successfull build of job 1, output of kubectl

JOb 2:-

Build Pipeline View:-

Finally deployed website is:-

Thank You !!

Github url:-

https://github.com/Ma9si/task-3-k8s.git