{"id":39861,"date":"2016-08-30T16:30:38","date_gmt":"2016-08-30T11:00:38","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=39861"},"modified":"2016-08-30T16:30:38","modified_gmt":"2016-08-30T11:00:38","slug":"control-jenkins-steps-with-conditional-buildstep-plugin","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/control-jenkins-steps-with-conditional-buildstep-plugin\/","title":{"rendered":"Control Jenkins Steps With Conditional BuildStep Plugin"},"content":{"rendered":"<p><del><\/del><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-39862 alignleft\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/w.png\" alt=\"w\" width=\"186\" height=\"124\" \/><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-39885\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/plugin-icon1.png\" alt=\"plugin-icon\" width=\"111\" height=\"111\" \/><\/p>\n<p>If you look forward to Jenkins for most of your development operations then, at some point in time you might have felt the need of something which allows you to condition your steps. Of course, it is not such a good idea to create individual jobs each time you want to run and test specific build step\/s. The solution is to use <strong>Conditional BuildStep<\/strong> plugin.<\/p>\n<p>Plugin&#8217;s latest release is 1.3.5 (June\u00a016, 2016). You may get it from <a href=\"https:\/\/wiki.jenkins-ci.org\/display\/JENKINS\/Conditional+BuildStep+Plugin\">here<\/a>.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>What does it do?<br \/>\n<\/strong><\/span><\/p>\n<p>The plugin gives you additional control over your build steps by simply allowing you to add various conditional checks. There are several conditions that you may choose from, and these are all defined by <a href=\"https:\/\/wiki.jenkins-ci.org\/display\/JENKINS\/Run+Condition+Plugin\">Run Condition Plugin<\/a>.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Conditional Steps<\/strong><\/span><\/p>\n<ul>\n<li>Conditional step (single): Ideal for scenarios when you might want to execute a step depending upon a condition, single conditional step maintains a simple if-then relationship between your condition and single step. Here is a snapshot for understanding:<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39875\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-131532.png\" alt=\"Screenshot from 2016-08-30 13:15:32\" width=\"907\" height=\"359\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-131532.png 907w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-131532-300x118.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-131532-624x246.png 624w\" sizes=\"(max-width: 907px) 100vw, 907px\" \/><\/p>\n<ul>\n<li>\u00a0Conditional steps (multiple): You might want to use this build step in the case where more than one step needs to be executed depending upon a condition:<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-39877\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-132320.png\" alt=\"Screenshot from 2016-08-30 13:23:20\" width=\"883\" height=\"567\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-132320.png 883w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-132320-300x192.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/08\/Screenshot-from-2016-08-30-132320-624x400.png 624w\" sizes=\"(max-width: 883px) 100vw, 883px\" \/><\/p>\n<p>Similarly, you may add any number of build steps whose execution depends on a condition. Moreover, you may have any number of such &#8216;Conditional steps&#8217; governed by different conditions each.<\/p>\n<p>In a way, Conditional BuildStep plugin tends to be a powerful utility giving you extended control over your build steps and reduces the number of jobs doing nearly the same thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you look forward to Jenkins for most of your development operations then, at some point in time you might have felt the need of something which allows you to condition your steps. Of course, it is not such a good idea to create individual jobs each time you want to run and test specific [&hellip;]<\/p>\n","protected":false},"author":934,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":27},"categories":[1174,2348,1],"tags":[248,3960,1892,1682,3958,3963,3961,3962,3959,65],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/39861"}],"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\/934"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=39861"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/39861\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=39861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=39861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=39861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}