{"id":88,"date":"2013-09-30T11:47:46","date_gmt":"2013-09-30T09:47:46","guid":{"rendered":"https:\/\/iww.inria.fr\/tech-zone\/?p=88"},"modified":"2013-09-30T11:49:36","modified_gmt":"2013-09-30T09:49:36","slug":"how-to-trigger-a-build-remotely","status":"publish","type":"post","link":"https:\/\/iww.inria.fr\/tech-zone\/how-to-trigger-a-build-remotely\/","title":{"rendered":"How to trigger a build remotely?"},"content":{"rendered":"<p>Jenkins gives a nice way to trigger builds remotely through its <a href=\"https:\/\/wiki.jenkins-ci.org\/display\/JENKINS\/Remote+access+API\" target=\"_blank\">ReST API<\/a>.<\/p>\n<p>The first problem that comes is to find a way to use this API without using your own account. Indeed, it is a bad idea to share your credentials with anyone having access to this script. To solve this issue, you can use the <a href=\"https:\/\/wiki.jenkins-ci.org\/display\/JENKINS\/Build+Token+Root+Plugin\" target=\"_blank\">Jenkins Build token root plugin<\/a>. You can simply install it through the Jenkins plugin manager.<\/p>\n<p>Then, you can configure your job to accept remote build triggers as follows:<\/p>\n<p><a href=\"https:\/\/iww.inria.fr\/tech-zone\/files\/2013\/09\/Capture-d\u2019\u00e9cran-2013-09-30-\u00e0-11.40.15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-89\" alt=\"remote-build-trigger\" src=\"https:\/\/iww.inria.fr\/tech-zone\/files\/2013\/09\/Capture-d\u2019\u00e9cran-2013-09-30-\u00e0-11.40.15-300x30.png\" width=\"300\" height=\"30\" srcset=\"https:\/\/iww.inria.fr\/tech-zone\/files\/2013\/09\/Capture-d\u2019\u00e9cran-2013-09-30-\u00e0-11.40.15-300x30.png 300w, https:\/\/iww.inria.fr\/tech-zone\/files\/2013\/09\/Capture-d\u2019\u00e9cran-2013-09-30-\u00e0-11.40.15-1024x102.png 1024w, https:\/\/iww.inria.fr\/tech-zone\/files\/2013\/09\/Capture-d\u2019\u00e9cran-2013-09-30-\u00e0-11.40.15.png 1339w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Don&#8217;t forget to provide a TOKEN.<\/p>\n<p>Then, from a remote script, you can simply invoke:<\/p>\n<pre>wget --no-check-certificate '<strong>JENKINS_SERVER<\/strong>\/buildByToken\/build?job=<strong>NAME<\/strong>&amp;token=<strong>SECRET'<\/strong><\/pre>\n<p>where:<\/p>\n<ul>\n<li>JENKINS_SERVER is the URL used to reach your jenkins server,<\/li>\n<li>NAME is the job name,<\/li>\n<li>and SECRET is the token you specified in the job configuration.<\/li>\n<\/ul>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Jenkins gives a nice way to trigger builds remotely through its ReST API. The first problem that comes is to find a way to use this API without using your own account. Indeed, it is a bad idea to share your credentials with anyone having access to this script. To solve this issue, you can &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/iww.inria.fr\/tech-zone\/how-to-trigger-a-build-remotely\/\">Continue reading<\/a><\/p>\n","protected":false},"author":395,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-jenkins","item-wrap"],"_links":{"self":[{"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":4,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":93,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/posts\/88\/revisions\/93"}],"wp:attachment":[{"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iww.inria.fr\/tech-zone\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}