mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-28 05:59:03 +00:00
30 lines
50 KiB
HTML
30 lines
50 KiB
HTML
<!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-reference-guides/pipelines/pipelines" data-has-hydrated="false">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v2.4.3">
|
||
<title data-rh="true">流水线 | Rancher</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="https://ranchermanager.docs.rancher.com/zh/v2.6/reference-guides/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"><meta data-rh="true" name="description" content="- 从 Rancher v2.5 开始,基于 Git 部署的流水线现已弃用。我们建议使用由 Fleet 提供支持的 Rancher Continuous Delivery 来处理流水线。要访问 Rancher 中的 Fleet,请点击 ☰ > 持续交付。"><meta data-rh="true" property="og:description" content="- 从 Rancher v2.5 开始,基于 Git 部署的流水线现已弃用。我们建议使用由 Fleet 提供支持的 Rancher Continuous Delivery 来处理流水线。要访问 Rancher 中的 Fleet,请点击 ☰ > 持续交付。"><link data-rh="true" rel="icon" href="/zh/img/favicon.png"><link data-rh="true" rel="canonical" href="https://ranchermanager.docs.rancher.com/zh/v2.6/reference-guides/pipelines"><link data-rh="true" rel="alternate" href="https://ranchermanager.docs.rancher.com/v2.6/reference-guides/pipelines" hreflang="en"><link data-rh="true" rel="alternate" href="https://ranchermanager.docs.rancher.com/zh/v2.6/reference-guides/pipelines" hreflang="zh"><link data-rh="true" rel="alternate" href="https://ranchermanager.docs.rancher.com/v2.6/reference-guides/pipelines" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://30NEY6C9UY-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script>window.dataLayer=window.dataLayer||[]</script>
|
||
<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>
|
||
|
||
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml" title="Rancher" href="/zh/opensearch.xml">
|
||
|
||
|
||
|
||
<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.29ec6351.css">
|
||
<link rel="preload" href="/zh/assets/js/runtime~main.7955d3d3.js" as="script">
|
||
<link rel="preload" href="/zh/assets/js/main.129d8862.js" as="script">
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-57KS2MW" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||
|
||
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||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 aria-label="主导航" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="切换导航栏" 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/">Latest</a></li><li><a class="dropdown__link" href="/zh/v2.9">v2.9 (Preview)</a></li><li><a class="dropdown__link" href="/zh/v2.8">v2.8</a></li><li><a class="dropdown__link" href="/zh/v2.7">v2.7</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/zh/v2.6/reference-guides/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/reference-guides/pipelines">v2.0-v2.4</a></li><li><a class="dropdown__link" href="/zh/versions">All versions</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><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/reference-guides/pipelines" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="en">English</a></li><li><a href="/zh/v2.6/reference-guides/pipelines" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="zh">简体中文</a></li></ul></div><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 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">Quick Links</a><ul class="dropdown__menu"><li><a href="https://github.com/rancher/rancher" target="_blank" rel="noopener noreferrer" class="dropdown__link">GitHub<svg width="12" height="12" 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></li><li><a href="https://github.com/rancher/rancher-docs" target="_blank" rel="noopener noreferrer" class="dropdown__link">Docs GitHub<svg width="12" height="12" 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></li></ul></div><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">More from SUSE</a><ul class="dropdown__menu"><li><a href="https://www.rancher.com" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__rancher">Rancher<svg width="12" height="12" 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></li><li><hr style="margin: 0.3rem 0;"></li><li><a href="https://elemental.docs.rancher.com/" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__elemental">Elemental<svg width="12" height="12" 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></li><li><a href="https://fleet.rancher.io/" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__fleet">Fleet<svg width="12" height="12" 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></li><li><a href="https://harvesterhci.io" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__harvester">Harvester<svg width="12" height="12" 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></li><li><a href="https://rancherdesktop.io/" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__rancher__desktop">Rancher Desktop<svg width="12" height="12" 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></li><li><hr style="margin: 0.3rem 0;"></li><li><a href="https://opensource.suse.com" target="_blank" rel="noopener noreferrer" class="dropdown__link navbar__icon navbar__suse">More Projects...<svg width="12" height="12" 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></li></ul></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="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="文档侧边栏" 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/how-to-guides/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/reference-guides/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/reference-guides/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/reference-guides/rancher-manager-architecture">Rancher 架构</a><button aria-label="打开/收起侧边栏菜单「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/reference-guides/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/reference-guides/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/reference-guides/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/reference-guides/monitoring-v2-configuration">Monitoring 配置</a><button aria-label="打开/收起侧边栏菜单「Monitoring 配置」" 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/reference-guides/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/reference-guides/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/reference-guides/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/reference-guides/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/reference-guides/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/reference-guides/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/integrations-in-rancher/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></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_YNFT"><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 v2.5 开始,基于 Git 部署的流水线现已弃用。我们建议使用由 <a href="/zh/v2.6/how-to-guides/new-user-guides/deploy-apps-across-clusters/fleet">Fleet</a> 提供支持的 Rancher Continuous Delivery 来处理流水线。要访问 Rancher 中的 Fleet,请点击 <b>☰ > 持续交付</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 体验,但它不能替代企业级 Jenkins 或团队使用的其他 CI 工具,也不能提供全部的功能和灵活性。</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 href="#概念" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><p>有关本节中使用的概念和术语的解释,请参阅<a href="/zh/v2.6/reference-guides/pipelines/concepts">本页。</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="流水线如何工作">流水线如何工作<a href="#流水线如何工作" class="hash-link" aria-label="标题的直接链接" 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 交互,因此它是托管和锁定的。</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 deployments 作为流水线引擎。</p></div></div></li><li><p><strong>Docker Registry:</strong></p><p>开箱即用,生成-发布步骤的默认目标是内部 Docker Registry。但是,你可以进行配置以推送到远程 registry。内部 Docker Registry 只能从集群节点访问,用户无法直接访问。镜像不会在流水线的生存期之后保留,并且只能在流水线运行中使用。如果需要在流水线运行之外访问镜像,请推送到外部 registry。</p></li><li><p><strong>Minio:</strong></p><p>Minio 存储用于存储流水线执行的日志。</p></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>托管的 Jenkins 实例以无状态方式工作,因此无需担心其数据持久性。默认情况下,Docker Registry 和 Minio 实例使用临时卷,这对于大多数用例来说都很好。如果要确保流水线日志能够在节点故障后继续运行,可以为它们配置持久卷,如<a href="/zh/v2.6/reference-guides/pipelines/configure-persistent-data">流水线组件的数据持久性</a>中所述。</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="流水线基于角色的访问控制">流水线基于角色的访问控制<a href="#流水线基于角色的访问控制" class="hash-link" aria-label="标题的直接链接" 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#cluster-roles">集群所有者或成员</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#project-roles">项目成员</a>可以配置版本控制提供程序并管理全局流水线执行设置。</p><p>项目成员只能配置存储库和流水线。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="设置流水线">设置流水线<a href="#设置流水线" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="先决条件">先决条件<a href="#先决条件" class="hash-link" aria-label="标题的直接链接" 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>legacy 功能标志:</div><div class="admonitionContent_S0QG"><p>由于流水线应用程序已被弃用,取而代之的是 Fleet,因此你需要在使用流水线之前打开 legacy 功能的功能标志。 请注意,Kubernetes 1.21+ 中不再支持流水线。</p><ol><li>点击左上角 <strong>☰ > 全局设置</strong>。</li><li>点击 <strong>功能开关</strong>。</li><li>转到 <code>legacy</code> 功能标志并点击 <strong>⋮ > 激活</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%E7%A8%8B%E5%BA%8F">配置版本控制提供程序</a></li><li><a href="#2-%E9%85%8D%E7%BD%AE%E5%AD%98%E5%82%A8%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 href="#1-配置版本控制提供程序" class="hash-link" aria-label="标题的直接链接" 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>☰ > 集群管理</strong>。</li><li>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</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>☰ > 集群管理</strong>。</li><li>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</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"><p>1.流水线使用 Gitlab <a href="https://docs.gitlab.com/ee/api/v3_to_v4.html" target="_blank" rel="noopener noreferrer">v4 API</a>,支持的 Gitlab 版本为 9.0+。 2. 如果你使用的是 GitLab 10.7+,并且你的 Rancher 设置位于本地网络中,请在 GitLab 管理员设置中启用 <strong>允许从钩子和服务向本地网络发出请求</strong> 选项。</p></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><ol><li>点击左上角 <strong>☰ > 集群管理</strong>。</li><li>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</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>☰ > 集群管理</strong>。</li><li>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</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。有关说明,请参阅<a href="https://confluence.atlassian.com/bitbucketserver/if-you-use-self-signed-certificates-938028692.html" target="_blank" rel="noopener noreferrer">配置自签名证书</a>的 Bitbucket server 文档。</li></ol></div></div></div></div></div><p><strong>结果:</strong> 对版本控制提供程序进行认证后,系统将自动重定向到开始配置要开始与流水线一起使用的存储库。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="2-配置存储库">2. 配置存储库<a href="#2-配置存储库" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><p>在对版本控制提供程序进行授权后,系统会自动将你重定向到开始配置要开始使用流水线的存储库。即使其他人设置了版本控制提供程序,你也会看到他们的存储库,并可以生成流水线。</p><ol><li><p>点击左上角 <strong>☰ > 集群管理</strong>。</p></li><li><p>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</p></li><li><p>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</p></li><li><p>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</strong>。</p></li><li><p>点击 <strong>配置</strong> 选项卡。</p></li><li><p>将显示存储库列表。如果你是第一次配置存储库,请单击 <strong>授权并获取你自己的存储库</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 href="#3-配置流水线" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><p>现在,存储库已添加到你的项目中,你可以通过添加自动化阶段和步骤来开始配置流水线。为方便起见,有多种内置步骤类型用于专用任务。</p><ol><li><p>点击左上角 <strong>☰ > 集群管理</strong>。</p></li><li><p>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</p></li><li><p>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</p></li><li><p>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</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>⋮ > 编辑配置</strong> 以使用 UI 配置流水线。配置流水线后,必须查看 YAML 文件并将其推送到存储库。</li><li>如果要使用 YAML 文件,请选择 <strong>⋮ > 查看/编辑 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 href="#流水线配置参考" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><p>有关如何将流水线配置为以下的详细信息,请参阅<a href="/zh/v2.6/reference-guides/pipelines/pipeline-configuration">此页面</a>:</p><ul><li>运行脚本</li><li>构建和发布镜像</li><li>发布 catalog 模板</li><li>部署 YAML</li><li>部署 catalog app</li></ul><p>配置参考还介绍了如何配置:</p><ul><li>通知</li><li>超时</li><li>触发流水线的规则</li><li>环境变量</li><li>密文</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="运行流水线">运行流水线<a href="#运行流水线" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><p>首次运行流水线。找到流水线并选择 <strong>⋮ > Run</strong>。</p><p>在此初始运行期间,将测试流水线,并将以下流水线组件作为专用于流水线的新命名空间中的工作负载部署到项目中:</p><ul><li><code>docker-registry</code></li><li><code>jenkins</code></li><li><code>minio</code></li></ul><p>此过程需要几分钟时间。完成后,可以从项目 <strong>Workloads</strong> 选项卡查看每个流水线组件。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="触发流水线">触发流水线<a href="#触发流水线" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h2><p>启用存储库后,会在版本控制提供程序中自动设置 Webhook。默认情况下,流水线由存储库的 <strong>push</strong> 事件触发,但你可以修改触发运行流水线的事件。</p><p>可用事件:</p><ul><li><strong>Push</strong>: 每当提交推送到仓库中的分支时,都会触发流水线。</li><li><strong>Pull Request</strong>: 每当向仓库发出拉取请求时,都会触发流水线。</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 href="#修改存储库的事件触发器" class="hash-link" aria-label="标题的直接链接" title="标题的直接链接"></a></h3><ol><li>点击左上角 <strong>☰ > 集群管理</strong>。</li><li>进入要配置流水线的集群,然后点击 <strong>浏览</strong>。</li><li>在顶部导航栏的下拉菜单中,选择要配置流水线的项目。</li><li>在左侧导航栏中,点击 <strong>Legacy > Project >流水线</strong>。</li><li>找到要修改事件触发器的存储库。选择 <strong>⋮ > Setting</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/reference-guides/pipelines/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="2024-05-06T07:06:07.000Z">2024年5月6日</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="#流水线基于角色的访问控制" 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><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 © 2024 SUSE Rancher. All Rights Reserved.</div></div></div></footer></div>
|
||
<script src="/zh/assets/js/runtime~main.7955d3d3.js"></script>
|
||
<script src="/zh/assets/js/main.129d8862.js"></script>
|
||
</body>
|
||
</html> |