{"id":5508,"date":"2019-08-21T22:40:34","date_gmt":"2019-08-22T03:40:34","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=5508"},"modified":"2019-08-23T07:52:54","modified_gmt":"2019-08-23T12:52:54","slug":"setting-up-gitlab-runner","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=5508","title":{"rendered":"Setting up gitlab-runner"},"content":{"rendered":"<p><strong><em>CLI on the GitLab server:<\/em><\/strong><\/p>\n<p># Set up the GitLab Repo<br \/>\ncurl -L https:\/\/packages.gitlab.com\/install\/repositories\/runner\/gitlab-runner\/script.rpm.sh<\/p>\n<p># Install package<br \/>\nyum install gitlab-runner<\/p>\n<p># verify runner is executable<br \/>\nll `which gitlab-runner`<br \/>\n# If needed, flag it executable \u2013 <em>shouldn\u2019t<\/em> be a problem with RPM installations, but it\u2019s been a problem for me with manual installs<br \/>\n#chmod ugo+x \/usr\/local\/bin\/gitlab-runner<\/p>\n<p># Register a runner<br \/>\ngitlab-runner register<\/p>\n<p># use URL &amp; token from http:\/\/&lt;GITLABSERVER&gt;\/admin\/runners<br \/>\n# add tags, if you want to use tags to assign runner<br \/>\n# executor: shell (and docker, if you want to use docker executors. The shell executor is the simplest case, so I am starting there)<\/p>\n<p># start the runner<br \/>\ngitlab-runner start<\/p>\n<p><strong><em>On the GitLab Web GUI: <\/em><\/strong><\/p>\n<p>Admin section =&gt; Overview =&gt; Runners. Click pencil to edit the runner and uncheck &#8220;Lock to current projects&#8221;, and (unless you want to use tagging) check &#8220;Run untagged jobs&#8221;<\/p>\n<p>** I was getting an error in every pipeline job saying the git command was not found.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"255\" class=\"wp-image-5509\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image.png 940w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-300x81.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-768x208.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>For most other commands, you can append to the path in the before_script section of your .gitlab-ci.yml<\/p>\n<p>before_script:<br \/>\n&#8211; export PATH=$PATH:\/opt\/whatever\/odd\/path\/bin<\/p>\n<p><em>But<\/em> that doesn\u2019t work in this case because we\u2019re not getting that far: the bootstrap \u201cstuff\u201d cannot fetch the project to <em>see<\/em> the before script. Git, on my system, was part of the GitLab package. I just created a symlink into a \u201cnormal\u201d binary location:<\/p>\n<p>root@gitlab:~# which git<br \/>\n\/opt\/gitlab\/embedded\/bin\/git<br \/>\nroot@gitlab:~# ln -s \/opt\/gitlab\/embedded\/bin\/git \/usr\/bin\/git<\/p>\n<p>And we\u2019ve got successful test execution:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1187\" height=\"789\" class=\"wp-image-5510\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-1.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-1.png 1187w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-1-300x199.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-1-768x510.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/08\/word-image-1-1024x681.png 1024w\" sizes=\"auto, (max-width: 1187px) 100vw, 1187px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CLI on the GitLab server: # Set up the GitLab Repo curl -L https:\/\/packages.gitlab.com\/install\/repositories\/runner\/gitlab-runner\/script.rpm.sh # Install package yum install gitlab-runner # verify runner is executable ll `which gitlab-runner` # If needed, flag it executable \u2013 shouldn\u2019t be a problem with RPM installations, but it\u2019s been a problem for me with manual installs #chmod ugo+x \/usr\/local\/bin\/gitlab-runner &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,30],"tags":[660,232,809,810],"class_list":["post-5508","post","type-post","status-publish","format-standard","hentry","category-coding","category-system-administration","tag-ci-cd","tag-gitlab","tag-pipelines","tag-shell-executor"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5508"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5508\/revisions"}],"predecessor-version":[{"id":5511,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5508\/revisions\/5511"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}