Files
rancher-docs/zh/v2.6/pages-for-subheaders/pipelines.html
T

24 lines
47 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="zh" dir="ltr" class="docs-wrapper docs-doc-page docs-version-2.6 plugin-docs plugin-id-default docs-doc-id-pages-for-subheaders/pipelines">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.2.0">
<title data-rh="true">流水线 | Rancher Manager</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="http://ranchermanager.docs.rancher.com/zh/v2.6/pages-for-subheaders/pipelines"><meta data-rh="true" name="docusaurus_locale" content="zh"><meta data-rh="true" name="docsearch:language" content="zh"><meta data-rh="true" name="docusaurus_version" content="2.6"><meta data-rh="true" name="docusaurus_tag" content="docs-default-2.6"><meta data-rh="true" name="docsearch:version" content="2.6"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-2.6"><meta data-rh="true" property="og:title" content="流水线 | Rancher Manager"><meta data-rh="true" name="description" content="- Rancher 2.5 开始已弃用基于 Git 的部署流水线。我们建议使用由 Fleet 提供支持的 Rancher Continuous Delivery (CD) 来处理流水线。如需在 Rancher 中访问 Fleet,请单击 ☰ &gt; 持续交付。"><meta data-rh="true" property="og:description" content="- Rancher 2.5 开始已弃用基于 Git 的部署流水线。我们建议使用由 Fleet 提供支持的 Rancher Continuous Delivery (CD) 来处理流水线。如需在 Rancher 中访问 Fleet,请单击 ☰ &gt; 持续交付。"><link data-rh="true" rel="icon" href="/zh/img/favicon.png"><link data-rh="true" rel="canonical" href="http://ranchermanager.docs.rancher.com/zh/v2.6/pages-for-subheaders/pipelines"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/v2.6/pages-for-subheaders/pipelines" hreflang="en"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/zh/v2.6/pages-for-subheaders/pipelines" hreflang="zh"><link data-rh="true" rel="alternate" href="http://ranchermanager.docs.rancher.com/v2.6/pages-for-subheaders/pipelines" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://30NEY6C9UY-dsn.algolia.net" crossorigin="anonymous"><link rel="search" type="application/opensearchdescription+xml" title="Rancher Manager" href="/zh/opensearch.xml">
<!-- Google Tag Manager -->
<script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-57KS2MW",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script>
<!-- End Google Tag Manager -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" charset="UTF-8" data-domain-script="0f98beb0-fc4c-417d-a42e-564e2cae42d2" async></script>
<script src="/scripts/optanonwrapper.js" async></script><link rel="stylesheet" href="/zh/assets/css/styles.19303192.css">
<link rel="preload" href="/zh/assets/js/runtime~main.ee5c32f6.js" as="script">
<link rel="preload" href="/zh/assets/js/main.bc269412.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div role="region" aria-label="跳到主要内容"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">跳到主要内容</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh/"><div class="navbar__logo"><img src="/zh/img/rancher-logo-horiz-color.svg" alt="logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/zh/img/rancher-logo-horiz-color.svg" alt="logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate"></b></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link active" aria-haspopup="true" aria-expanded="false" role="button" href="/zh/v2.6">v2.6</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/zh/">v2.7</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/zh/v2.6/pages-for-subheaders/pipelines">v2.6</a></li><li><a class="dropdown__link" href="/zh/v2.5">v2.5</a></li><li><a class="dropdown__link" href="/zh/v2.0-v2.4/pages-for-subheaders/pipelines">v2.0-v2.4</a></li><li><a class="dropdown__link" href="/zh/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_nlXk"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>简体中文</a><ul class="dropdown__menu"><li><a href="/v2.6/pages-for-subheaders/pipelines" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="en">English</a></li><li><a href="/zh/v2.6/pages-for-subheaders/pipelines" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="zh">简体中文</a></li></ul></div><a href="https://github.com/rancher/rancher-docs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar__github">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://rancher.com" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Rancher Home<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh/v2.6">什么是 Rancher?</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/v2.6/getting-started/overview">开始使用</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/v2.6/pages-for-subheaders/new-user-guides">操作指南</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/zh/v2.6/pages-for-subheaders/best-practices">参考指南</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/best-practices">最佳实践</a><button aria-label="打开/收起侧边栏菜单「最佳实践」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/rancher-manager-architecture">Rancher Manager 架构</a><button aria-label="打开/收起侧边栏菜单「Rancher Manager 架构」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/cluster-configuration">集群配置</a><button aria-label="打开/收起侧边栏菜单「集群配置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/single-node-rancher-in-docker">Docker 中的单节点 Rancher</a><button aria-label="打开/收起侧边栏菜单「Docker 中的单节点 Rancher」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/backup-restore-configuration">备份和恢复配置</a><button aria-label="打开/收起侧边栏菜单「备份和恢复配置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/kubernetes-concepts">Kubernetes 概念</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/monitoring-v2-configuration">Monitoring V2 配置</a><button aria-label="打开/收起侧边栏菜单「Monitoring V2 配置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/prometheus-federator">Prometheus Federator</a><button aria-label="打开/收起侧边栏菜单「Prometheus Federator」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/user-settings">用户设置</a><button aria-label="打开/收起侧边栏菜单「用户设置」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/cli-with-rancher">Rancher CLI</a><button aria-label="打开/收起侧边栏菜单「Rancher CLI」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/about-the-api">关于 API</a><button aria-label="打开/收起侧边栏菜单「关于 API」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/rancher-cluster-tools">集群工具:Logging,Monitoring 和可视化</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/rancher-project-tools">项目工具:Logging,Monitoring 和可视化</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/system-tools">系统工具</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/rke1-template-example-yaml">RKE1 示例 YAML</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" tabindex="0" href="/zh/v2.6/pages-for-subheaders/pipelines">流水线</a><button aria-label="打开/收起侧边栏菜单「流水线」" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/pipelines/concepts">概念</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/pipelines/pipeline-configuration">流水线配置参考</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/pipelines/configure-persistent-data">为流水线组件配置持久数据</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/pipelines/example-repositories">示例仓库</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/zh/v2.6/reference-guides/pipelines/example-yaml">示例 YAML 文件</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh/v2.6/pages-for-subheaders/rancher-security">Rancher 安全</a><button aria-label="打开/收起侧边栏菜单「Rancher 安全」" type="button" class="clean-btn menu__caret"></button></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/v2.6/pages-for-subheaders/cloud-marketplace">Rancher 中的集成</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/v2.6/faq/general-faq">常见问题</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh/v2.6/troubleshooting/general-troubleshooting">故障排除</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/zh/v2.6/contribute-to-rancher">参与 Rancher 社区贡献</a></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="页面路径"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="主页面" class="breadcrumbs__link" href="/zh/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">参考指南</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">流水线</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">版本:v2.6</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">本页总览</button></div><div class="theme-doc-markdown markdown"><header><h1>流水线</h1></header><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>注意事项</div><div class="admonitionContent_S0QG"><ul><li><p>Rancher 2.5 开始已弃用基于 Git 的部署流水线。我们建议使用由 <a href="/zh/v2.6/how-to-guides/new-user-guides/deploy-apps-across-clusters/fleet">Fleet</a> 提供支持的 Rancher Continuous Delivery (CD) 来处理流水线。如需在 Rancher 中访问 Fleet,请单击 <b>☰ &gt; 持续交付</b>。</p></li><li><p>不再支持 Kubernetes 1.21+ 中的流水线。</p></li><li><p>Fleet 不会取代 Rancher 流水线,只是 Rancher 流水线现在由 Fleet 提供支持。</p></li></ul></div></div><p>Rancher 的流水线提供了简单的 CI/CD 体验。你可以使用流水线来自动签出代码、运行构建或脚本、发布 Docker 镜像或商店应用,以及将更新的软件部署给用户。</p><p>设置流水线可以帮助开发者快速高效地上线新软件。你可以使用 Rancher 与 GitHub 仓库集成,从而设置持续集成(CI)流水线。</p><p>配置 Rancher 和 GitHub 后,你可以部署运行 Jenkins 的容器来自动化执行流水线:</p><ul><li>将应用代码构建为镜像。</li><li>验证构建。</li><li>将构建的镜像部署到集群。</li><li>运行单元测试。</li><li>运行回归测试。</li></ul><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>Rancher 的流水线提供简单的 CI/CD 体验,但不提供完整的功能和灵活性,也不能替代你团队正在使用的企业级 Jenkins 或其他 CI 工具。</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="概念">概念<a class="hash-link" href="#概念" title="标题的直接链接">​</a></h2><p>有关本节中使用的概念和术语说明,请参阅<a href="/zh/v2.6/reference-guides/pipelines/concepts">此页面</a>。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="流水线的工作原理">流水线的工作原理<a class="hash-link" href="#流水线的工作原理" title="标题的直接链接">​</a></h2><p>为项目中启用流水线功能后,你可以在每个项目中配置多个流水线。每个流水线都是独一无二的,可以独立配置。</p><p>流水线是由一组签入源代码仓库的文件配置的。用户可以通过 Rancher UI 或通过将 <code>.rancher-pipeline.yml</code> 添加到仓库来配置流水线。</p><p>在配置流水线之前,你需要为版本控制提供商(例如 GitHub、GitLab 或 Bitbucket)配置身份验证。如果你还没有配置版本控制提供商,你可以随时使用 <a href="/zh/v2.6/reference-guides/pipelines/example-repositories">Rancher 的示例仓库</a>来查看​​常见的流水线部署。</p><p>在项目中配置流水线时,会自动创建一个专门用于该流水线的命名空间。以下组件部署到它:</p><ul><li><p><strong>Jenkins</strong>:</p><p>流水线的构建引擎。由于项目用户不直接与 Jenkins 交互,因此 Jenkins 是被托管和锁定的。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>没有使用现有 Jenkins deployment 作为流水线引擎的选项。</p></div></div></li><li><p><strong>Docker 镜像仓库</strong>:</p><p> 内部 Docker 镜像仓库是开箱即用,用于构建到发布步骤的默认目标。你也可以进行配置以推送到远程镜像仓库。内部 Docker 镜像仓库只能从集群节点访问,用户不能直接访问它。镜像不会在流水线的生命周期之外被持久化,并且只能在流水线运行使用。如果你需要在流水线运行之外访问镜像,请将镜像推送到外部镜像仓库。</p></li><li><p><strong>Minio</strong>:</p><p>Minio 存储用于存储流水线执行的日志。</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>托管的 Jenkins 实例是无状态工作的,因此你不用担心它的数据持久性。Docker 镜像仓库和 Minio 实例默认使用临时卷,这种做法适用于大多数用例。如果你想确保流水线日志能够在节点故障的情况下也能保存,你可以为它们配置持久卷(参见<a href="/zh/v2.6/reference-guides/pipelines/configure-persistent-data">流水线组件的数据持久性</a>)。</p></div></div></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="流水线的-rbac">流水线的 RBAC<a class="hash-link" href="#流水线的-rbac" title="标题的直接链接">​</a></h2><p>如果你可以访问项目,则可以启用仓库来开始构建流水线。</p><p>只有<a href="/zh/v2.6/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/global-permissions">管理员</a>、<a href="/zh/v2.6/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#%E9%9B%86%E7%BE%A4%E8%A7%92%E8%89%B2">集群所有者或成员</a>或<a href="/zh/v2.6/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#%E9%A1%B9%E7%9B%AE%E8%A7%92%E8%89%B2">项目所有者</a>可以配置版本控制提供商和管理全局流水线的执行设置。</p><p>项目成员只能配置仓库和流水线。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="设置流水线">设置流水线<a class="hash-link" href="#设置流水线" title="标题的直接链接">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="先决条件">先决条件<a class="hash-link" href="#先决条件" title="标题的直接链接">​</a></h3><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>旧版功能开关:</div><div class="admonitionContent_S0QG"><p>由于流水线应用已被弃用并替换为 Fleet,因此在使用流水线之前,你需要打开旧版功能的功能开关。请注意,我们不再支持 Kubernetes 1.21+ 中的流水线。</p><ol><li>在左上角,单击 <strong>☰ &gt; 全局设置</strong>。</li><li>单击<strong>功能开关</strong>。</li><li>转到<code>旧版应用 </code>功能开关并单击 <strong>⋮ &gt; 激活</strong>。</li></ol></div></div><ol><li><a href="#1-%E9%85%8D%E7%BD%AE%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6%E6%8F%90%E4%BE%9B%E5%95%86">配置版本控制提供商</a></li><li><a href="#2-%E9%85%8D%E7%BD%AE%E4%BB%93%E5%BA%93">配置仓库</a></li><li><a href="#3-%E9%85%8D%E7%BD%AE%E6%B5%81%E6%B0%B4%E7%BA%BF">配置流水线</a></li></ol><h3 class="anchor anchorWithStickyNavbar_LWe7" id="1-配置版本控制提供商">1. 配置版本控制提供商<a class="hash-link" href="#1-配置版本控制提供商" title="标题的直接链接">​</a></h3><p>在为仓库配置流水线之前,你必须配置和授权版本控制提供商:</p><ul><li>GitHub</li><li>GitLab</li><li>Bitbucket</li></ul><p>在下方选择你的提供商对应的选项卡,然后按照说明进行操作。</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">GitHub</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">GitLab</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Bitbucket Cloud</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Bitbucket Server</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</li><li>单击<strong>配置</strong>选项卡。</li><li>按照说明<strong>设置 Github 应用</strong>。Rancher 会将你重定向到 GitHub 以在 GitHub 中设置 OAuth 应用。</li><li>从 GitHub 复制 <strong>Client ID</strong> 和 <strong>Client Secret</strong>。将它们粘贴到 Rancher 中。</li><li>如果你使用的是企业版 GitHub,请选择<strong>使用私有 GitHub 企业版安装</strong>。输入 GitHub 安装的主机地址。</li><li>单击<strong>验证</strong>。</li></ol></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</li><li>单击<strong>配置</strong>选项卡。</li><li>单击 <strong>GitLab</strong>。</li><li>按照说明<strong>设置 GitLab 应用</strong>。Rancher 会将你重定向到 GitLab。</li><li>从 GitLab 复制 <strong>Application ID</strong> 和 <strong>Secret</strong>。将它们粘贴到 Rancher 中。</li><li>如果你使用的是企业版 GitLab,请选择<strong>使用私有 GitLab 企业版安装</strong>。输入 GitLab 安装的主机地址。</li><li>单击<strong>验证</strong>。</li></ol><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>注意事项:</div><div class="admonitionContent_S0QG"><ol><li>流水线使用 GitLab <a href="https://docs.gitlab.com/ee/api/v3_to_v4.html" target="_blank" rel="noopener noreferrer">v4 API</a>,支持的 GitLab 版本为 9.0+。</li><li>如果你使用 GitLab 10.7+ 并且你的 Rancher 设置位于本地网络中,请在 GitLab 管理设置中启用 <strong>Allow requests to the local network from hooks and services</strong> 选项。</li></ol></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</li><li>单击<strong>配置</strong>选项卡。</li><li>单击 <strong>Bitbucket</strong> 并保留默认选中的<strong>使用 Bitbucket Cloud</strong>。</li><li>按照说明<strong>设置 Bitbucket Cloud 应用</strong>。Rancher 会将你重定向到 Bitbucket 以在 Bitbucket 中设置 OAuth 使用者。</li><li>从 Bitbucket 复制使用者 <strong>Key</strong> 和 <strong>Secret</strong>。将它们粘贴到 Rancher 中。</li><li>单击<strong>验证</strong>。</li></ol></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</li><li>单击<strong>配置</strong>选项卡。</li><li>点击 <strong>Bitbucket</strong> 并选择<strong>使用私有 Bitbucket Server 设置</strong>选项。</li><li>按照说明<strong>设置 Bitbucket Server 应用</strong>。</li><li>输入 Bitbucket Server 安装的主机地址。</li><li>单击<strong>验证</strong>。</li></ol><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>Bitbucket server 在向 Rancher 发送 webhook 时需要进行 SSL 验证。请确保 Rancher server 的证书被 Bitbucket server 信任。有两种选择:</p><ol><li>使用受信任的 CA 签发的证书来设置 Rancher server。</li><li>如果你使用的是自签名证书,请将 Rancher server 的证书导入 Bitbucket server。有关说明,请参阅 Bitbucket sever 文档以了解如何<a href="https://confluence.atlassian.com/bitbucketserver/if-you-use-self-signed-certificates-938028692.html" target="_blank" rel="noopener noreferrer">配置自签名证书</a>。</li></ol></div></div></div></div></div><p><strong>结果</strong>:版本控制提供商通过身份验证后,你将被自动重定向以配置你希望使用流水线的仓库。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="2-配置仓库">2. 配置仓库<a class="hash-link" href="#2-配置仓库" title="标题的直接链接">​</a></h3><p>授权版本控制提供商后,你将被自动重定向以配置你希望使用流水线的仓库。即使其他人设置了版本控制提供商,你也能看到他们的仓库并构建流水线:</p><ol><li><p>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</p></li><li><p>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</p></li><li><p>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</p></li><li><p>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</p></li><li><p>单击<strong>配置仓库</strong>。</p></li><li><p>此处会显示仓库列表。如果你是第一次配置仓库,请单击 <strong>Authorize &amp; Fetch Your Own Repositories</strong> 来获取你的仓库列表。</p></li><li><p>在要设置流水线的仓库处单击<strong>启用</strong>。</p></li><li><p>启用所有仓库后,单击<strong>完成</strong>。</p></li></ol><p><strong>结果</strong>:你有了一个可以配置流水线的仓库列表。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="3-配置流水线">3. 配置流水线<a class="hash-link" href="#3-配置流水线" title="标题的直接链接">​</a></h3><p>现在仓库已添加到你的项目中。你可以通过添加自动化阶段和步骤来配置流水线。为方便起见,我们提供了多种用于特有任务的内置步骤类型。</p><ol><li><p>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</p></li><li><p>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</p></li><li><p>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</p></li><li><p>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</p></li><li><p>找到要设置流水线的仓库。</p></li><li><p>通过 UI 或使用仓库中的 YAML 文件(即 <code>.rancher-pipeline.yml</code> 或 <code>.rancher-pipeline.yaml</code>)配置流水线。流水线配置分为阶段和步骤。必须完全完成阶段后才能进入下一个阶段,但一个阶段中的步骤可以同时运行。你可以在每个阶段中添加不同的步骤类型。请注意,在构建步骤时,会根据步骤类型提供不同的高级选项。高级选项包括触发规则、环境变量和密文。有关通过 UI 或 YAML 文件配置流水线的更多信息,请参阅<a href="/zh/v2.6/reference-guides/pipelines/pipeline-configuration">流水线配置参考</a>。</p><ul><li>如果要使用 UI,请选择 <strong>⋮ &gt; 编辑配置</strong>以使用 UI 配置流水线。配置流水线后,你必须查看 YAML 文件并将其推送到仓库。</li><li>如果你要使用 YAML 文件,请选择 <strong>⋮ &gt; 查看/编辑 YAML</strong> 来配置流水线。如果你使用 YAML 文件,你需要在更改文件后将更新的文件推送到仓库,以便更新仓库中的内容。在编辑流水线配置时,Rancher 需要花一些时间检查现有的流水线配置。</li></ul></li><li><p>从分支列表中选择要使用的<code>分支</code>。</p></li><li><p>可选:设置通知。</p></li><li><p>设置流水线的触发规则。</p></li><li><p>为流水线输入<strong>超时</strong>。</p></li><li><p>配置完所有阶段和步骤后,单击<strong>完成</strong>。</p></li></ol><p><strong>结果</strong> :你的流水线已配置好并可以运行了。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="流水线配置参考">流水线配置参考<a class="hash-link" href="#流水线配置参考" title="标题的直接链接">​</a></h2><p>参见<a href="/zh/v2.6/reference-guides/pipelines/pipeline-configuration">此页面</a>以了解如何通过配置流水线实现以下目的:</p><ul><li>运行脚本</li><li>构建和发布镜像</li><li>发布应用商店模板</li><li>部署 YAML</li><li>部署商店应用</li></ul><p>配置参考还包括如何配置:</p><ul><li>通知</li><li>超时</li><li>触发流水线的规则</li><li>环境变量</li><li>密文</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="运行流水线">运行流水线<a class="hash-link" href="#运行流水线" title="标题的直接链接">​</a></h2><p>首次运行你的流水线。找到你的流水线并选择 <strong>⋮ &gt; 运行</strong>。</p><p>在此初始运行期间将测试你的流水线。以下流水线组件将作为工作负载部署到你的项目专用于该流水线的命名空间:</p><ul><li><code>docker-registry</code></li><li><code>jenkins</code></li><li><code>minio</code></li></ul><p>这个过程需要几分钟。完成后,你可以从项目的<strong>工作负载</strong>选项卡中查看每个流水线组件。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="触发流水线">触发流水线<a class="hash-link" href="#触发流水线" title="标题的直接链接">​</a></h2><p>启用仓库后,会在版本控制提供商中自动设置 webhook。默认情况下,流水线会由 <strong>push</strong> 事件触发到仓库,但你也可以修改触发运行流水线的事件。</p><p>可用事件:</p><ul><li><strong>Push</strong>:当提交被推送到仓库中的分支时,触发流水线。</li><li><strong>Pull Request</strong>:对仓库发起 PR 时,触发流水线。</li><li><strong>Tag</strong>:在仓库中创建标签时,触发流水线。</li></ul><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>备注</div><div class="admonitionContent_S0QG"><p>Rancher 的<a href="/zh/v2.6/reference-guides/pipelines/example-repositories">示例仓库</a>不存在此选项。</p></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="修改仓库的事件触发器">修改仓库的事件触发器<a class="hash-link" href="#修改仓库的事件触发器" title="标题的直接链接">​</a></h3><ol><li>在左上角,单击 <strong>☰ &gt; 集群管理</strong>。</li><li>转到要配置流水线的集群,然后单击 <strong>Explore</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,单击 <strong>Legacy &gt; 项目 &gt; 流水线</strong>。</li><li>找到要修改事件触发器的仓库。选择 <strong>⋮ &gt; 设置</strong>。</li><li>为仓库选择所需的事件触发器(<strong>Push</strong>、<strong>Pull Request</strong> 或 <strong>Tag</strong>)。</li><li>单击<strong>保存</strong>。</li></ol></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/rancher/rancher-docs/edit/main/versioned_docs/version-2.6/pages-for-subheaders/pipelines.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>编辑此页</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">最后<!-- -->于 <b><time datetime="2023-01-03T02:14:16.000Z">2023年1月3日</time></b> <!-- -->更新</span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="文档分页导航"><a class="pagination-nav__link pagination-nav__link--prev" href="/zh/v2.6/reference-guides/rke1-template-example-yaml"><div class="pagination-nav__sublabel">上一页</div><div class="pagination-nav__label">RKE1 示例 YAML</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/zh/v2.6/reference-guides/pipelines/concepts"><div class="pagination-nav__sublabel">下一页</div><div class="pagination-nav__label">概念</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#概念" class="table-of-contents__link toc-highlight">概念</a></li><li><a href="#流水线的工作原理" class="table-of-contents__link toc-highlight">流水线的工作原理</a></li><li><a href="#流水线的-rbac" class="table-of-contents__link toc-highlight">流水线的 RBAC</a></li><li><a href="#设置流水线" class="table-of-contents__link toc-highlight">设置流水线</a><ul><li><a href="#先决条件" class="table-of-contents__link toc-highlight">先决条件</a></li><li><a href="#1-配置版本控制提供商" class="table-of-contents__link toc-highlight">1. 配置版本控制提供商</a></li><li><a href="#2-配置仓库" class="table-of-contents__link toc-highlight">2. 配置仓库</a></li><li><a href="#3-配置流水线" class="table-of-contents__link toc-highlight">3. 配置流水线</a></li></ul></li><li><a href="#流水线配置参考" class="table-of-contents__link toc-highlight">流水线配置参考</a></li><li><a href="#运行流水线" class="table-of-contents__link toc-highlight">运行流水线</a></li><li><a href="#触发流水线" class="table-of-contents__link toc-highlight">触发流水线</a><ul><li><a href="#修改仓库的事件触发器" class="table-of-contents__link toc-highlight">修改仓库的事件触发器</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2022 SUSE Rancher. All Rights Reserved.</div></div></div></footer></div>
<script src="/zh/assets/js/runtime~main.ee5c32f6.js"></script>
<script src="/zh/assets/js/main.bc269412.js"></script>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-57KS2MW" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --></body>
</html>