{"id":132,"date":"2020-02-09T22:17:10","date_gmt":"2020-02-09T14:17:10","guid":{"rendered":"http:\/\/kevinliao.myds.me\/wordpress\/?p=132"},"modified":"2020-02-10T09:13:36","modified_gmt":"2020-02-10T01:13:36","slug":"mac%e7%92%b0%e5%a2%83%e4%b8%ad%e5%bb%ba%e7%bd%aegitlab-runner","status":"publish","type":"post","link":"https:\/\/kevinliao.myds.me\/wordpress\/2020\/02\/09\/mac%e7%92%b0%e5%a2%83%e4%b8%ad%e5%bb%ba%e7%bd%aegitlab-runner\/","title":{"rendered":"Mac\u74b0\u5883\u4e2d\u5efa\u7f6eGitlab-runner"},"content":{"rendered":"\n<p>\u76ee\u524d\u5728\u958b\u767c\u74b0\u5883\u4e2d\uff0c\u81ea\u52d5\u5316\u6574\u5408\u8207\u4f48\u7f72\u5df2\u7d93\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u4f5c\uff0c\u800cGitlab\u6709\u63d0\u4f9b\u4e86\u81ea\u52d5\u5316\u6574\u5408\uff0c\u8b93\u7a0b\u5f0f\u78bc\u7570\u52d5commit\u9032repo\u6642\u80fd\u81ea\u52d5\u57f7\u884c\u555f\u52d5\uff0c\u7136\u5f8cgitlab-runner\u6703\u628a\u80fd\u5920\u57f7\u884c\u7684job\u6293\u4e0b\u4f86\u57f7\u884c\u4e26\u628a\u7d50\u679c\u56de\u50b3\u5230gitlab\uff0c\u4f86\u9054\u5230\u81ea\u52d5\u5316\u6e2c\u8a66\u8207\u81ea\u52d5\u5316\u4f48\u7f72<\/p>\n\n\n\n<h2>install gitlab-runner<\/h2>\n\n\n\n<p>\u5728\u5b89\u88ddgitlab-runner \u74b0\u5883\uff0c\u56e0\u70ba\u662f\u9700\u8981\u4f7f\u7528\u500b\u4eba\u5e33\u865f\u57f7\u884c pod install \u4e26\u4e14\u9700\u8981\u81ea\u52d5\u767b\u5165\uff0c\u5426\u5247\u6703\u9047\u5230 &#8220;<strong>gitlab-runner is not running<\/strong>&#8220;\u7684\u554f\u984c\uff0c\u6240\u4ee5\u5efa\u8b70\u662f\u5148\u5728Mac\u74b0\u5883\u4e2d\u5efa\u7acb\u7368\u7acb\u7684\u5e33\u865f\uff0c\u4ee5\u4e0b\u5148\u5b89\u88ddhomebrew \u5957\u4ef6\uff0c\u518d\u4f7f\u7528homebrew \u5b89\u88ddgitlab-runner<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/usr\/bin\/ruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"\n$ brew install gitlab-runner\n$ brew services start gitlab-runner<\/code><\/pre>\n\n\n\n<h2>\u5efa\u7acbgitlab-runner \u8cc7\u6599\u593e<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mkdir ~\/gitlab_runner\n$ cd ~\/gitlab_runner<\/code><\/pre>\n\n\n\n<h2>Register gitlab-runner<\/h2>\n\n\n\n<p> \u5728\u8a3b\u518agitlab-runner \u4e4b\u524d\u9700\u8981\u5148\u8ddfgitlab \u53d6\u5f97hostname \u8207token<br>\u5728Project \u7684setting \u4e2d\u6709\u500bCI\/CD , \u518d\u6253\u958brunners \u7684\u8a2d\u5b9a\u5f8c\uff0c\u53ef\u4ee5\u53d6\u5f97hostname \u548ctoken<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"302\" src=\"http:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-1024x302.png\" alt=\"\" class=\"wp-image-133\" srcset=\"https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-1024x302.png 1024w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-300x88.png 300w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-768x226.png 768w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-1200x354.png 1200w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.25.06-400x118.png 400w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gitlab-runner register\nRuntime platform                                    arch=amd64 os=darwin pid=36852 revision=003fe500 version=12.7.1\nWARNING: Running in user-mode.\nWARNING: Use sudo for system-mode:\nWARNING: $ sudo gitlab-runner...\n\nPlease enter the gitlab-ci coordinator URL (e.g. https:\/\/gitlab.com\/):\nhttp:\/\/kevinliao.myds.me:30000\/\nPlease enter the gitlab-ci token for this runner:\nWwLj3BzUN9sdgtgzziZw\nPlease enter the gitlab-ci description for this runner:\n[Chienyus-iMac.local]: ios-runner\nPlease enter the gitlab-ci tags for this runner (comma separated):\nios,android,react-native\nRegistering runner... succeeded                     runner=WwLj3BzU\nPlease enter the executor: docker-ssh, shell, ssh, virtualbox, docker+machine, docker-ssh+machine, custom, parallels, kubernetes, docker:\nshell\nRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u9019\u88e1\u6709\u500b\u5f88\u91cd\u8981\u7684\u4e00\u9ede\uff0c\u5c31\u662f\u4e0d\u80fd\u4f7f\u7528sudo \u53bb\u8dd1system-mode \u56e0\u70bapod install \u8981\u6c42\u4f7f\u7528user-mode , \u5982\u679c\u4f7f\u7528system-mode \u6703\u5831\u932f\u800c\u7121\u6cd5\u57f7\u884c\u3002<br> \u6240\u4ee5 Gitlab-runner for Mac \u4e0d\u80fd\u4f7f\u7528ssh \u9032\u884c\u64cd\u4f5c \u8981\u7528 terminal GUI <\/p><\/blockquote>\n\n\n\n<ul><li>Please enter the gitlab-ci description for this runner  \u8f38\u5165runner \u7684\u540d\u7a31<\/li><li>Please enter the gitlab-ci tags for this runner (comma separated) \u8f38\u5165runner \u7684tag \u5f8c\u7e8c\u53ef\u4ee5\u5728yml \u6a94\u4e2d\u4f7f\u7528tag\u8b93\u7279\u5b9a\u7684runner\u4f86\u57f7\u884c<\/li><li>Please enter the executor: docker-ssh, shell, ssh, virtualbox, docker+machine, docker-ssh+machine, custom, parallels, kubernetes, docker \u56e0\u70ba\u6211\u5011\u9019\u88e1\u4f7f\u7528<strong>shell<\/strong> \u4f86\u57f7\u884c<\/li><\/ul>\n\n\n\n<p>Registering runer &#8230; succeeded \u5f8c\u53ef\u4ee5\u770b\u5230gitlab-runner \u5df2\u7d93\u6210\u529f\uff0c\u5982\u679c\u4e0d\u80fd\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u6aa2\u67e5gitlab-runner  \u72c0\u614b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gitlab-runner install \/\/\u81ea\u52d5\u57f7\u884cgitlab-runner service\n$ gitlab-runner staus  \/\/ \u76ee\u524d\u904b\u4f5c\u72c0\u614b\n$ gitlab-runner status gitlab-runner list \/\/\u5217\u51fa\u6240\u6709\u7684runner\n$ gitlab-runner verify --delete \/\/\u91cd\u65b0\u9a57\u8b49\u6240\u6709\u7684runner\uff0c\u4e26\u79fb\u9664\u7121\u6cd5\u4f7f\u7528\u7684<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"220\" src=\"http:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-1024x220.png\" alt=\"\" class=\"wp-image-134\" srcset=\"https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-1024x220.png 1024w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-300x64.png 300w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-768x165.png 768w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-1200x258.png 1200w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56-400x86.png 400w, https:\/\/kevinliao.myds.me\/wordpress\/wp-content\/uploads\/2020\/02\/\u622a\u5716-2020-02-09-\u4e0b\u53489.37.56.png 1638w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<h2>\u5c08\u6848\u52a0\u5165.gitlab-ci.yml \u6a94\u6848<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>stages:\n  - test\n\nvariables:\n  LC_ALL: \"en_US.UTF-8\"\n\nbefore_script:\n- pod install\n\ntest:\n stage: test\n script:\n    - xcodebuild clean build -workspace helloCI.xcworkspace -scheme helloCI -allowProvisioningUpdates\n    - xcodebuild test -workspace helloCI.xcworkspace -scheme helloCI -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.3' | xcpretty -s\n tags:\n  - ios<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524d\u5728\u958b\u767c\u74b0\u5883\u4e2d\uff0c\u81ea\u52d5\u5316\u6574\u5408\u8207\u4f48\u7f72\u5df2\u7d93\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u4f5c\uff0c\u800cGitlab\u6709\u63d0\u4f9b\u4e86\u81ea\u52d5\u5316\u6574\u5408\uff0c\u8b93\u7a0b\u5f0f\u78bc\u7570\u52d5comm &hellip; <a href=\"https:\/\/kevinliao.myds.me\/wordpress\/2020\/02\/09\/mac%e7%92%b0%e5%a2%83%e4%b8%ad%e5%bb%ba%e7%bd%aegitlab-runner\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Mac\u74b0\u5883\u4e2d\u5efa\u7f6eGitlab-runner\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[17],"tags":[18,22,19],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/posts\/132"}],"collection":[{"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":3,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/posts\/132\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kevinliao.myds.me\/wordpress\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}