{"id":21823,"date":"2015-06-29T12:35:53","date_gmt":"2015-06-29T07:05:53","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=21823"},"modified":"2015-06-29T14:30:08","modified_gmt":"2015-06-29T09:00:08","slug":"jenkins-parameterized-remote-trigger-plugin","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/jenkins-parameterized-remote-trigger-plugin\/","title":{"rendered":"Jenkins Parameterized Remote Trigger Plugin"},"content":{"rendered":"<p>At times you encounter a use case where you need to run a Jenkins job remotely from another Jenkins instance. Well, there is a way to achieve this by using Parameterized Remote Trigger plugin.<\/p>\n<p>Let&#8217;s see how we can\u00a0trigger parameterized or non-parameterized jobs on remote Jenkins server from another Jenkins server.<\/p>\n<p><strong><span style=\"color: #ffa500\">Demonstration<\/span><\/strong><\/p>\n<p>Lets say we have two Jenkins server namely JenkinsOne and JenkinsTwo and we have a job name &#8220;TEST&#8221; on JenkinsTwo which we want to trigger from JenkinsOne.<\/p>\n<p>To achieve the above stated task, we need to download Parameterized Remote Trigger Plugin on JenkinsOne. You can do that by clicking on Manage Jenkins option and then choosing Manage Plugins, wherein you can search and download the desired plugin.<\/p>\n<p>Our JenkinsTwo server has password based access. So to trigger a job on it, first we need to log in to the server and then build the job. For this to happen from a remote server, we need to provide credentials to it. So before triggering a remote build on JenkinsOne, set the credentials by following the below mentioned steps.<\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 1:<\/strong><br \/>\n<span style=\"color: #000000\">Go to Manage Credentials option after choosing Manage Jenkins option on your console.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/23.png\" alt=\"2\" width=\"575\" height=\"313\" border=\"5\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 2:<\/strong><br \/>\n<span style=\"color: #000000\">After that, choose add domain option. As our JenkinsTwo is a remote server so we need to specify its host name here.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/33.png\" alt=\"3\" width=\"609\" height=\"357\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 3:<\/strong><br \/>\n<span style=\"color: #000000\">After this\u00a0specify the credentials so that we can log into JenkinsTwo. Since on the JenkinsTwo server we have password based authentication, we have to choose &#8220;Username with password&#8221; option as shown in the screenshot below.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/43.png\" alt=\"4\" width=\"627\" height=\"370\" \/><\/p>\n<p>Specify scope, username and password and save the changes.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/52.png\" alt=\"5\" width=\"803\" height=\"280\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/62.png\" alt=\"6\" width=\"632\" height=\"215\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 4:<\/strong><br \/>\n<span style=\"color: #000000\">Now go to Configure System option after selecting Manage Jenkins option. \u00a0Under Parameterized Remote Trigger Configuration, click on Add.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/83.png\" alt=\"8\" width=\"851\" height=\"226\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 5:<\/strong><br \/>\n<span style=\"color: #000000\">As soon as we click on Add, the Display name field will automatically show\u00a0already added remote Jenkins server which is JenkinsTwo. After checking the &#8220;Use the credentials Plugin&#8221; option, we can see the already provided credentials. Now to access the server, we need to provide JenkinsTwo\u00a0address and port number.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/93.png\" alt=\"9\" width=\"758\" height=\"290\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 6:<\/strong><br \/>\n<span style=\"color: #000000\">Now make a new job in JenkinsOne. Here we are making this as a parameterized job, since our &#8220;TEST&#8221; job on JenkinsTwo is parameterized.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/104.png\" alt=\"10\" width=\"657\" height=\"325\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 7:<\/strong><br \/>\n<span style=\"color: #000000\">Now under the Build section, choose &#8220;Trigger a remotely parameterized job&#8221; option in the drop down menu of &#8220;Add build step&#8221; option as shown below.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/113.png\" alt=\"11\" width=\"627\" height=\"324\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 8:<\/strong><br \/>\n<span style=\"color: #000000\">After doing that, we can choose our remote Jenkins server in &#8220;Select a remote host&#8221; field.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/121.png\" alt=\"12\" width=\"626\" height=\"311\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 9:<\/strong><br \/>\n<span style=\"color: #000000\">Type the name of the job which you want to build on remote jenkins server i.e. &#8220;TEST&#8221; job on JenkinsTwo server in our case. Specify the parameter i.e &#8220;NAME&#8221; required by the &#8220;TEST&#8221; job. Also, we need to use the value defined here in &#8220;name&#8221; parameter as shown below. Save your configuration changes.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/132.png\" alt=\"13\" width=\"772\" height=\"400\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 10:<\/strong><br \/>\n<span style=\"color: #000000\">The final step remaining is to Build the job.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/141.png\" alt=\"14\" width=\"698\" height=\"342\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 11:<\/strong><br \/>\n<span style=\"color: #000000\">After building the job, in the Console Output we can see that the job has been remotely built if all the configuration changes have been made correctly.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/151.png\" alt=\"15\" width=\"694\" height=\"331\" \/><\/p>\n<p><span style=\"color: #ffa500\"><strong>Step 12:<\/strong><br \/>\n<span style=\"color: #000000\">On our remote server \u00a0&#8220;JenkinsTwo&#8221;, if we can log in, we can verify that our job has been executed with the parameter&#8217;s value that was provided on JenkinsOne server and by the same user whose credentials we provided in the \u00a0initial steps.<\/span><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" style=\"border: 1px groove #545565\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/16.png\" alt=\"16\" width=\"1362\" height=\"692\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>At times you encounter a use case where you need to run a Jenkins job remotely from another Jenkins instance. Well, there is a way to achieve this by using Parameterized Remote Trigger plugin. Let&#8217;s see how we can\u00a0trigger parameterized or non-parameterized jobs on remote Jenkins server from another Jenkins server. Demonstration Lets say 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":95},"categories":[1174,1],"tags":[1682,1934,1930,1931],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/21823"}],"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=21823"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/21823\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=21823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=21823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=21823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}