{"id":21606,"date":"2026-11-06T11:27:46","date_gmt":"2026-11-06T03:27:46","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=21606"},"modified":"2026-11-06T17:59:36","modified_gmt":"2026-11-06T09:59:36","slug":"gitlab-ci-cd","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2026\/11\/06\/gitlab-ci-cd\/","title":{"rendered":"GitLab CI\/CD"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GitLab CI\/CD \u4e3b\u8981\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u90e8\u5206<\/th><th>\u7528\u9014<\/th><\/tr><\/thead><tbody><tr><td>GitLab<\/td><td>\u5b58\u653e\u4ee3\u7801\uff0c\u8bfb\u53d6\u6d41\u6c34\u7ebf\u914d\u7f6e\uff0c\u521b\u5efa\u4efb\u52a1\uff0c\u5c55\u793a\u7ed3\u679c<\/td><\/tr><tr><td>GitLab Runner<\/td><td>\u5b9e\u9645\u6267\u884c\u6d4b\u8bd5\u3001\u7f16\u8bd1\u3001\u6253\u5305\u547d\u4ee4<\/td><\/tr><tr><td><code>.gitlab-ci.yml<\/code><\/td><td>\u653e\u5728\u4ee3\u7801\u4ed3\u5e93\u6839\u76ee\u5f55\uff0c\u5b9a\u4e49\u4ec0\u4e48\u65f6\u5019\u6267\u884c\u3001\u6267\u884c\u54ea\u4e9b\u547d\u4ee4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5de5\u4f5c\u6d41\u7a0b\u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5f00\u53d1\u4eba\u5458\u63a8\u9001\u4ee3\u7801\n       \u2193\nGitLab \u8bfb\u53d6 .gitlab-ci.yml\n       \u2193\nGitLab \u521b\u5efa\u6d41\u6c34\u7ebf\u548c\u4efb\u52a1\n       \u2193\nRunner \u83b7\u53d6\u4efb\u52a1\u3001\u62c9\u53d6\u4ee3\u7801\n       \u2193\n\u5728\u6307\u5b9a\u73af\u5883\u91cc\u6267\u884c\u6d4b\u8bd5\u548c\u6784\u5efa\n       \u2193\n\u5c06\u65e5\u5fd7\u3001\u6d4b\u8bd5\u62a5\u544a\u3001\u6784\u5efa\u4ea7\u7269\u4e0a\u4f20\u5230 GitLab<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-palette-color-2-color\">\u5b89\u88c5gitlab<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u5305\u4e0b\u8f7d\u5730\u5740(\u4ee5Ubuntu\u7cfb\u7edf\u4e3a\u4f8b)\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;packages.gitlab.com\/gitlab\/gitlab-ce\/ubuntu\/noble\/pool\/main\/g\/gitlab-ce\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u76f4\u63a5\u4e00\u952e\u5b89\u88c5\u5373\u53ef\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -i gitlab-ce_19.5.3-ce.0_amd64.deb<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u540e\u7684\u51e0\u4e2a\u4e3b\u8981\u8def\u5f84\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\/opt\/gitlab<\/code>\uff1a\u7a0b\u5e8f\u5b89\u88c5\u4f4d\u7f6e\uff08\u53ea\u8bfb\uff0c\u5305\u7ba1\u7406\u7ef4\u62a4\uff09<\/li>\n\n\n\n<li><code>\/etc\/gitlab<\/code>\uff1a\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e<\/li>\n\n\n\n<li><code>\/var\/opt\/gitlab<\/code>\uff1a\u4e1a\u52a1\u6570\u636e\uff08\u4ed3\u5e93\u3001\u6570\u636e\u5e93\u3001ci \u5236\u54c1\uff09<\/li>\n\n\n\n<li><code>\/var\/log\/gitlab<\/code>\uff1a\u65e5\u5fd7<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u540e\u4fee\u6539\u4fee\u6539\u7684\u914d\u7f6e\u53ef\u53c2\u8003<a href=\"https:\/\/blog.ywdevops.cn\/index.php\/2021\/08\/15\/gitlab\/\" target=\"_blank\" rel=\"noopener\">gitlab\u5b89\u88c5\u4ee5\u53ca\u4f7f\u7528<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5efa\u8bae\u4f7f\u7528\u4e00\u53f0\u72ec\u7acb Linux \u670d\u52a1\u5668\u5b89\u88c5 Runner\uff0c\u672c\u4f8b\u5b50\u4e2d\u4f7f\u7528docker\u8fd0\u884cgitlab-runner\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo install -d -m 0755 \/srv\/gitlab-runner\/config\n\nsudo docker run -d \\\n  --name gitlab-runner \\\n  --restart always \\\n  -v \/srv\/gitlab-runner\/config:\/etc\/gitlab-runner \\\n  -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\n  gitlab\/gitlab-runner:latest<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>GitLab CI\/CD \u4e3b\u8981\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\uff1a \u90e8\u5206 \u7528\u9014 GitLab \u5b58\u653e\u4ee3\u7801\uff0c\u8bfb\u53d6\u6d41\u6c34\u7ebf\u914d\u7f6e\uff0c\u521b\u5efa\u4efb\u52a1\uff0c [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":21607,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-21606","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/21606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=21606"}],"version-history":[{"count":10,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/21606\/revisions"}],"predecessor-version":[{"id":21623,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/21606\/revisions\/21623"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/21607"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=21606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=21606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=21606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}