{"id":3214,"date":"2021-10-07T13:09:09","date_gmt":"2021-10-07T12:09:09","guid":{"rendered":"https:\/\/inlab.fib.upc.edu\/?p=3214"},"modified":"2023-05-24T09:18:05","modified_gmt":"2023-05-24T08:18:05","slug":"runners-2","status":"publish","type":"post","link":"https:\/\/inlab.fib.upc.edu\/en\/news\/runners-2","title":{"rendered":"Runners"},"content":{"rendered":"<p class=\"rtejustify\"><strong>Gitlab CI\/CD<\/strong> is a DevOps tool integrated into Gitlab to be able to make continuous integration, continuous delivery and continuous deployment. In order to use this tool you must use the Gitlab Runners, which are applications that are responsible for running the Gitlab CI\/CD pipeline jobs.<\/p>\n<p class=\"rtejustify\">Although Gitlab servers may have shared runners that any user can use, we may be interested in having one or more Runners in our machine. In this article we will explain how you can do it quickly and easily.<\/p>\n<h2 class=\"rtejustify\"><strong>Installation&nbsp;using&nbsp;Docker&nbsp;containers<\/strong><\/h2>\n<p class=\"rtejustify\">There&nbsp;are&nbsp;multiple ways&nbsp;to&nbsp;install&nbsp;a&nbsp;Runner&nbsp;on&nbsp;a&nbsp;machine,&nbsp;but&nbsp;the&nbsp;most&nbsp;flexible&nbsp;way&nbsp;and&nbsp;the&nbsp;one&nbsp;we&nbsp;will&nbsp;explain&nbsp;in&nbsp;this&nbsp;article&nbsp;is&nbsp;using Docker containers<\/p>\n<p class=\"rtejustify\">The&nbsp;requirements&nbsp;to&nbsp;be&nbsp;able&nbsp;to&nbsp;install&nbsp;and&nbsp;use&nbsp;a&nbsp;Runner&nbsp;with&nbsp;Docker&nbsp;are&nbsp;as&nbsp;follows:<\/p>\n<ul>\n<li class=\"rtejustify\">Have&nbsp;a&nbsp;machine&nbsp;with&nbsp;Docker&nbsp;installed&nbsp;and&nbsp;understand&nbsp;its&nbsp;basic&nbsp;operation&nbsp;<\/li>\n<li class=\"rtejustify\">Have&nbsp;a&nbsp;Runners&nbsp;registration&nbsp;<strong>token<\/strong>&nbsp;in&nbsp;a&nbsp;Gitlab&nbsp;group&nbsp;or&nbsp;project<\/li>\n<\/ul>\n<p class=\"rtejustify\">To&nbsp;obtain&nbsp;the&nbsp;registration&nbsp;token&nbsp;you&nbsp;only&nbsp;have&nbsp;to&nbsp;go&nbsp;to&nbsp;the&nbsp;group&nbsp;or&nbsp;project&nbsp;where&nbsp;we&nbsp;want&nbsp;to&nbsp;register&nbsp;the&nbsp;Runner&nbsp;and&nbsp;access&nbsp;&#8220;<strong>Settings -&gt; CI\/CD&nbsp;-&gt; Runners<\/strong>&#8220;.<\/p>\n<p class=\"rtejustify\">It&nbsp;is&nbsp;important&nbsp;that&nbsp;you&nbsp;keep&nbsp;the&nbsp;<strong>token<\/strong>&nbsp;secret,&nbsp;since&nbsp;using&nbsp;this&nbsp;token&nbsp;anyone&nbsp;can&nbsp;register&nbsp;a&nbsp;Runner&nbsp;in&nbsp;your&nbsp;project&nbsp;and&nbsp;potentially&nbsp;gain&nbsp;access&nbsp;to&nbsp;the&nbsp;files. If&nbsp;you&nbsp;leak it,&nbsp;press&nbsp;the&nbsp;&#8220;<strong>Reset&nbsp;registration&nbsp;token<\/strong>&#8221;&nbsp;button&nbsp;to&nbsp;get&nbsp;a&nbsp;new&nbsp;one.<\/p>\n<p class=\"rtejustify\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img fetchpriority=\"high\" decoding=\"async\" class=\" size-full wp-image-3174\" alt=\"\" src=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-1.png\" style=\"width: 715px; height: 486px;\" width=\"715\" height=\"486\" srcset=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-1.png 715w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-1-300x204.png 300w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-1-370x251.png 370w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p class=\"rtejustify\">Un cop obtingut el token de registre cal crear el contenidor que s\u2019encarregar\u00e0 d\u2019executar els Runners. Per fer-ho cal executar les seg\u00fcents comandes amb permisos d\u2019administrador:<\/p>\n<p class=\"rtejustify\"><span style=\"text-align: justify;\">Once&nbsp;the&nbsp;registration&nbsp;token&nbsp;is&nbsp;obtained,&nbsp;you&nbsp;must&nbsp;create&nbsp;the&nbsp;container&nbsp;that&nbsp;will&nbsp;be&nbsp;in&nbsp;charge&nbsp;of&nbsp;running&nbsp;the&nbsp;Runners.&nbsp;To&nbsp;do&nbsp;this,&nbsp;you&nbsp;must&nbsp;execute&nbsp;the&nbsp;following&nbsp;orders&nbsp;with&nbsp;<\/span><br \/>\n<span style=\"text-align: justify;\">administrator permissions:<\/span><\/p>\n<pre class=\"rtejustify\">\r\ndocker volume create gitlab-runner-config\r\ndocker run -d --name gitlab-runner --restart always \\\r\n    -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\r\n    -v gitlab-runner-config:\/etc\/gitlab-runner \\\r\n    gitlab\/gitlab-runner:latest\r\n<\/pre>\n<p class=\"rtejustify\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img decoding=\"async\" class=\" size-full wp-image-3177\" alt=\"\" src=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-2.png\" style=\"width: 713px; height: 273px;\" width=\"713\" height=\"273\" srcset=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-2.png 713w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-2-300x115.png 300w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-2-370x142.png 370w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p class=\"rtejustify\">The next step is to register a Runner to run our pipelines.&nbsp;This can be done by running the following order and supplying the data it requests:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<pre class=\"rtejustify\">\r\n<span style=\"white-space: pre-wrap;\">docker run --rm -it -v gitlab-runner-config:\/etc\/gitlab-runner <\/span><\/pre>\n<pre class=\"rtejustify\">\r\ngitlab\/gitlab-runner:latest register \r\n<\/pre>\n<p class=\"rtejustify\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img decoding=\"async\" class=\" size-full wp-image-3180\" alt=\"\" src=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-3.png\" style=\"text-align: justify; width: 823px; height: 236px;\" width=\"823\" height=\"236\" srcset=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-3.png 823w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-3-300x86.png 300w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-3-768x220.png 768w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-3-370x106.png 370w\" sizes=\"(max-width: 823px) 100vw, 823px\" \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p class=\"rtejustify\">Finally, you have to go to <strong>Settings<\/strong>, <strong>CI\/CD<\/strong>, <strong>Runners<\/strong> and see if the Runner appears in the &#8220;<strong>Available specific runners<\/strong>&#8221; section.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p class=\"rtejustify\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-3183\" alt=\"\" src=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-4.png\" style=\"width: 557px; height: 149px;\" width=\"557\" height=\"149\" srcset=\"https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-4.png 557w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-4-300x80.png 300w, https:\/\/inlab.fib.upc.edu\/wp-content\/uploads\/2021\/10\/runner-4-370x99.png 370w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/p>\n<p class=\"rtejustify\">If it appears it is that everything has gone well and we can already use it to run our pipelines. In case it is necessary to have more Runners, just repeat the order used to register a new one.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p class=\"rtejustify\">&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gitlab CI\/CD is a DevOps tool integrated into Gitlab to be able to make continuous integration, continuous delivery and continuous deployment. In order to use this tool you must use the Gitlab Runners, which are applications that are responsible for running the Gitlab CI\/CD pipeline jobs. Although Gitlab servers may have shared runners that any [&hellip;]<\/p>\n","protected":false},"author":1211,"featured_media":3171,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[571],"tags":[],"experteses":[],"class_list":["post-3214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/posts\/3214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/users\/1211"}],"replies":[{"embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/comments?post=3214"}],"version-history":[{"count":1,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/posts\/3214\/revisions"}],"predecessor-version":[{"id":20823,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/posts\/3214\/revisions\/20823"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/media\/3171"}],"wp:attachment":[{"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/media?parent=3214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/categories?post=3214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/tags?post=3214"},{"taxonomy":"experteses","embeddable":true,"href":"https:\/\/inlab.fib.upc.edu\/en\/wp-json\/wp\/v2\/experteses?post=3214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}