{"id":21206,"date":"2015-06-19T19:41:52","date_gmt":"2015-06-19T14:11:52","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=21206"},"modified":"2015-06-19T19:41:52","modified_gmt":"2015-06-19T14:11:52","slug":"jenkins-coordinator-plugin","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/jenkins-coordinator-plugin\/","title":{"rendered":"Jenkins Coordinator Plugin"},"content":{"rendered":"<p>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.<\/p>\n<p>This post will walk you through how to use this plugin to run your jobs \u00a0in a particular sequence.<\/p>\n<p>Suppose we have four jobs : \u00a0Job1, 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.<\/p>\n<p>Lets begin by making Job1.<\/p>\n<p><strong><span style=\"color: #ffa500\">Step 1: Create a new freestyle job as shown below:<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-21207\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/job11.png\" alt=\"job11\" width=\"771\" height=\"285\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step 2: Choose &#8220;This build is parameterized&#8221; \u00a0and \u00a0then the type of \u00a0parameter which you want from the options in the drop down menu. We have chosen &#8220;String parameter&#8221; option for simplicity.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-21213 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/job16.png\" alt=\"\" width=\"1022\" height=\"267\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21210\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/job13.png\" alt=\"job13\" width=\"1009\" height=\"254\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step 3: We will be using this parameter value in our job which will be entered by the user. Use &#8220;Execute shell&#8221; option from the &#8220;Build&#8221; drop down menu and write an echo command to print it&#8217;s value. &#8220;Save&#8221; this job once done.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21211\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/job14.png\" alt=\"job14\" width=\"1076\" height=\"199\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21212\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/job15.png\" alt=\"job15\" width=\"1066\" height=\"262\" \/><\/p>\n<p>Similarly we have made our Job2 with parameter &#8220;age&#8221; , and non-parametrized Job3 and Job4.<\/p>\n<p>You can download Coordinator Plugin \u00a0through &#8220;Manage Plugins&#8221; option in &#8220;Manage Jenkins&#8221; tab.<\/p>\n<p>After installing it, make a new coordinator project\/job as shown below:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21216\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cj.png\" alt=\"cj\" width=\"875\" height=\"340\" \/><\/p>\n<p>Now under the Coordinator job, make all the parameters as defined in your respective jobs.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21218\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cj13.png\" alt=\"cj13\" width=\"1031\" height=\"527\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step1:\u00a0Under the &#8220;Build&#8221; section, right-click on &#8220;Root&#8221; and click on &#8220;Create&#8221; option from the drop down menu.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21219\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cja.png\" alt=\"cja\" width=\"946\" height=\"343\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step2: Now to execute Job1 and Job2 sequentially, we have created &#8220;sequential&#8221; job under which we will be adding them.<\/span><\/strong><\/p>\n<p><span style=\"color: #ffa500\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21220\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cjb.png\" alt=\"cjb\" width=\"895\" height=\"286\" \/><\/span><\/p>\n<p><strong><span style=\"color: #ffa500\">Step3: Choose &#8220;create&#8221; option after right-clicking on &#8220;sequential&#8221; and then write the desired job names.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21221\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cjd.png\" alt=\"cjd\" width=\"588\" height=\"323\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step4: Here, we will be defining Job1 and Job2 as shown below :<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21224\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cjg.png\" alt=\"cjg\" width=\"597\" height=\"262\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-21225\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cjh.png\" alt=\"cjh\" width=\"598\" height=\"291\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step5: Now, to run Job3 and Job4 parallely, again right-click on &#8220;Root&#8221; and create &#8220;parallel&#8221; job and then add both the jobs under it following the same procedure as mentioned above. <\/span><\/strong><\/p>\n<p>As you can see, the &#8220;S&#8221; sign on &#8220;sequential&#8221; signifies the jobs under it will run sequentially, thats by default. To run Job3 and Job4 parallely, right-click on &#8220;parallel&#8221; and choose &#8220;Swtich P&#8221; option for the same.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-21226\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/cje1.png\" alt=\"cje\" width=\"575\" height=\"386\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step6: \u00a0After completing, save changes to your job and then click on &#8220;Build with parameters&#8221; option to execute it.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21230\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/build.png\" alt=\"build\" width=\"882\" height=\"346\" \/><\/p>\n<p><strong><span style=\"color: #ffa500\">Step7: \u00a0Under the &#8220;Execution Plan&#8221; tab, you can still select which jobs you want to execute and under &#8220;Parameters&#8221; tab, you can define the value of the parameters which your respective jobs require.<\/span><\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21231\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/build1.png\" alt=\"build1\" width=\"766\" height=\"334\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21232\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/build2.png\" alt=\"build2\" width=\"982\" height=\"321\" \/><\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21233\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/build3.png\" alt=\"build3\" width=\"652\" height=\"298\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u00a0in a particular sequence. Suppose we have four jobs : \u00a0Job1, Job2 ,Job3, Job4. We [&hellip;]<\/p>\n","protected":false},"author":204,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":17},"categories":[1174],"tags":[1893,1682,1894],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/21206"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/204"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=21206"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/21206\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=21206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=21206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=21206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}