{"id":1810,"date":"2020-04-02T18:37:55","date_gmt":"2020-04-02T15:37:55","guid":{"rendered":"https:\/\/artem.services\/?p=1805"},"modified":"2020-04-02T19:23:00","modified_gmt":"2020-04-02T16:23:00","slug":"1810","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1810&lang=en","title":{"rendered":"Jenkins &#8212; Username"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-819\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png\" alt=\"\" width=\"1280\" height=\"412\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png 1280w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-300x97.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-768x247.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-1024x330.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-954x307.png 954w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>In order to find out <strong>Jenkins<\/strong> username, you need a plugin <a href=\"https:\/\/plugins.jenkins.io\/build-user-vars-plugin\/\" target=\"_blank\" rel=\"noopener noreferrer\">user build vars<\/a><\/p>\n<p>Go to <strong>Jenkins<\/strong> settings<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1782\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001.png\" alt=\"\" width=\"349\" height=\"383\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001.png 349w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001-273x300.png 273w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Section &quot;<strong>Manage Plugins<\/strong>&quot;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1783\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002.png\" alt=\"\" width=\"927\" height=\"493\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002.png 927w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002-300x160.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002-768x408.png 768w\" sizes=\"(max-width: 927px) 100vw, 927px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Go to the &quot;<strong>Available<\/strong>&quot; tab and specify &quot;<strong>user build vars<\/strong>&quot; in the search.<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1806\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53.png\" alt=\"\" width=\"2154\" height=\"490\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53.png 2154w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-300x68.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-1024x233.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-768x175.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-1536x349.png 1536w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-2048x466.png 2048w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-954x217.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-02-at-17.53.53-1354x308.png 1354w\" sizes=\"(max-width: 2154px) 100vw, 2154px\" \/><\/p>\n<p>Install it.<\/p>\n<p>&nbsp;<\/p>\n<p>An example of using a plugin from <strong>Pipeline<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npipeline {\r\n  agent any\r\n  stages {\r\n    stage('Output') {\r\n      steps {\r\n        script {\r\n          wrap([$class: 'BuildUser']) {\r\n            echo &quot;Build was started by user: ${BUILD_USER}&quot;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The module also has the following variables:<\/p>\n<ul>\n<li><strong>BUILD_USER<\/strong> &#8212; Full name (first name + last name)<\/li>\n<li><strong>BUILD_USER_FIRST_NAME<\/strong> &#8212; First name<\/li>\n<li><strong>BUILD_USER_LAST_NAME<\/strong> &#8212; Last name<\/li>\n<li><strong>BUILD_USER_ID<\/strong> &#8212; Jenkins user ID<\/li>\n<li><strong>BUILD_USER_EMAIL<\/strong> &#8212; Email address<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In order to find out Jenkins username, you need a plugin user build vars Go to Jenkins settings &nbsp; Section &quot;Manage Plugins&quot; &nbsp; Go to the &quot;Available&quot; tab and specify &quot;user build vars&quot; in the search. Install it. &nbsp; An example of using a plugin from Pipeline: &nbsp; The module also has the following variables: &hellip; <a href=\"https:\/\/artem.services\/?p=1810&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Jenkins &#8212; Username&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[613],"tags":[617,641,1247,1469],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1810"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1810"}],"version-history":[{"count":4,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1810\/revisions"}],"predecessor-version":[{"id":1817,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1810\/revisions\/1817"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}