Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • GitCode
  • 帮助文档帮助文档
  • Wiki
    • Docs
    • Ci
    • Pipelines
  • schedules

帮助文档
帮助文档
  • 项目概览

GitCode / 帮助文档

通知 1805
Star 580
Fork 459
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 44
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 1
  • DevOps
    • 流水线
    • 流水线任务
    • 计划
  • Wiki 89
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 代码片段
  • 项目成员
  • Pages
帮助文档
帮助文档
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 44
    • Issue 44
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 1
    • 合并请求 1
  • Pages
  • DevOps
    • DevOps
    • 流水线
    • 流水线任务
    • 计划
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 89
    • Wiki
  • 代码片段
    • 代码片段
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 流水线任务
  • 提交
  • Issue看板

schedules · 变更

页面历史
update file 编写于 6月 04, 2021 作者: BaiXuePrincess's avatar BaiXuePrincess
隐藏空白更改
内联 并排
Showing with 32 addition and 58 deletion
+32 -58
  • docs/ci/pipelines/schedules.md docs/ci/pipelines/schedules.md +32 -58
  • 未找到文件。
docs/ci/pipelines/schedules.md
View page @ ed71f99e
# Pipeline schedules # 流水线计划[](#pipeline-schedules "Permalink")
> 原文:[https://docs.gitlab.com/ee/ci/pipelines/schedules.html](https://docs.gitlab.com/ee/ci/pipelines/schedules.html) 流水线通常是在满足某些条件的情况下运行的. 例如,将分支推送到存储库时.
- [Pipeline schedules](#pipeline-schedules) 流水线计划可以用于以特定时间间隔运行流水线. 例如:
- [Pipeline schedules](#pipeline-schedules-1)
- [Prerequisites](#prerequisites)
- [Configuring pipeline schedules](#configuring-pipeline-schedules)
- [Using variables](#using-variables)
- [Using only and except](#using-only-and-except)
- [Advanced configuration](#advanced-configuration)
- [Working with scheduled pipelines](#working-with-scheduled-pipelines)
- [Running manually](#running-manually)
- [Taking ownership](#taking-ownership)
# Pipeline schedules[](#pipeline-schedules "Permalink") * 每月的 22 号为特定的分支.
版本历史
* 在 GitLab 9.1 中作为[触发计划](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10533)引入.
* 在 GitLab 9.2 中[重命名为 Pipeline Schedule](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10853) .
**注意:** Cron 表示法由[Fugit](https://github.com/floraison/fugit)解析.
管道通常是在满足某些条件的情况下运行的. 例如,将分支推送到存储库时.
管道计划可以用于以特定间隔运行[管道](index.html) . 例如:
* 每个月的 22 号都有特定的分支机构.
* 每天一次. * 每天一次.
除了使用 GitLab UI 外,还可以使用[Pipeline schedules API](../../api/pipeline_schedules.html)维护[管道时间表](../../api/pipeline_schedules.html) . 除了使用 GitLab UI 外,还可以使用[Pipeline schedules API](../../api/pipeline_schedules.html)维护[流水线计划](../../api/pipeline_schedules.html) .
**注意:** 调度时间是用 Cron 符号配置的,由[Fugit](https://github.com/floraison/fugit)解析.
## Prerequisites[](#prerequisites "Permalink") ## 先决条件[](#prerequisites "Permalink")
为了成功创建计划的管道: 为了成功创建计划的管道:
...@@ -40,36 +20,32 @@ ...@@ -40,36 +20,32 @@
否则,不会创建管道. 否则,不会创建管道.
## Configuring pipeline schedules[](#configuring-pipeline-schedules "Permalink") ## 配置流水线计划[](#configuring-pipeline-schedules "Permalink")
计划项目的管道: 计划项目的管道:
1. 导航到项目的**CI / CD>计划**页面. 1. 导航到项目的**CI / CD>计划**页面.
2. 单击**新建计划**按钮. 2. 单击**新建计划**按钮.
3. 填写**计划表中的新管道**表单. 3. 填写**新建流水线计划**表单.
4. 单击**保存管道计划**按钮. 4. 单击**保存流水线计划**按钮.
[![New Schedule Form](img/b379b1821f4b3d10ab0be61a59bcd491.png)](img/pipeline_schedules_new_form.png) [![New Schedule Form](/docs/img/b379b1821f4b3d10ab0be61a59bcd491.png)](/docs/img/pipeline_schedules_new_form.png)
**注意:**管道执行[时间取决于](#advanced-configuration) Sidekiq 自己的时间表. **注意:**流水线执行[时间取决于](#advanced-configuration) Sidekiq 自己的时间表.
在" **计划**索引"页面中,您可以看到计划运行的管道的列表. 下次运行由安装了 GitLab 的服务器自动计算. 在 **计划**索引页面中,您可以看到计划运行的流水线列表. 下次运行由安装了 GitLab 的服务器自动计算.
[![Schedules list](img/de408a3a079dceb2e72d044abac21ac3.png)](img/pipeline_schedules_list.png) [![Schedules list](img/de408a3a079dceb2e72d044abac21ac3.png)](img/pipeline_schedules_list.png)
### Using variables[](#using-variables "Permalink") ### 使用变量[](#using-variables "Permalink")
在 GitLab 9.4 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/12328) .
您可以传递任意数量的任意变量,它们将在 GitLab CI / CD 中可用,以便可以在您的[`.gitlab-ci.yml`文件中使用](../../ci/yaml/README.html) . 您可以传递任意数量的任意变量,它们将在 CODECHINA CI/CD 中可用,以便可以在您的[`.gitlab-ci.yml`文件中使用](../../ci/yaml/README.html) .
[![Scheduled pipeline variables](img/2e1001a11cd343049b87ebf60a315e9f.png)](img/pipeline_schedule_variables.png) [![Scheduled pipeline variables](img/2e1001a11cd343049b87ebf60a315e9f.png)](img/pipeline_schedule_variables.png)
### Using only and except[](#using-only-and-except "Permalink") ### 使用 only 和 except[](#using-only-and-except "Permalink")
要配置仅在计划了管道(或相反)时才可以执行作业,您只能使用[且](../yaml/README.html#onlyexcept-basic)不能使用配置关键字. 要配置仅在计划了流水线(或相反)时才可以执行作业,您只能使用[only 和 except](../yaml/README.html#onlyexcept-basic)配置关键字.
For example:
``` ```
job:on-schedule: job:on-schedule:
...@@ -85,9 +61,9 @@ job: ...@@ -85,9 +61,9 @@ job:
- make build - make build
``` ```
### Advanced configuration[](#advanced-configuration "Permalink") ### 高级配置[](#advanced-configuration "Permalink")
管道不会完全按计划执行,因为计划由 Sidekiq 处理,Sidekiq 根据其间隔运行. 流水线不会完全按计划执行,因为计划由 Sidekiq 处理,Sidekiq 根据其间隔运行.
例如,如果满足以下条件,则每天只会创建两个管道: 例如,如果满足以下条件,则每天只会创建两个管道:
...@@ -97,39 +73,37 @@ job: ...@@ -97,39 +73,37 @@ job:
更改 Sidekiq 工作人员的频率: 更改 Sidekiq 工作人员的频率:
1. 在实例的`gitlab.rb`文件中编辑`gitlab_rails['pipeline_schedule_worker_cron']`值. 1. 在实例的`gitlab.rb`文件中编辑`gitlab_rails['pipeline_schedule_worker_cron']`值.
2. [重新配置 GitLab,](../../administration/restart_gitlab.html#omnibus-gitlab-reconfigure)以使更改生效. 2. [重新配置 GitLab](../../administration/restart_gitlab.html#omnibus-gitlab-reconfigure)以使更改生效.
对于 GitLab.com,请参阅[专用设置页面](../../user/gitlab_com/index.html#gitlab-cicd) . 对于 GitLab.com,请参阅[专用设置页面](../../user/gitlab_com/index.html#gitlab-cicd) .
## Working with scheduled pipelines[](#working-with-scheduled-pipelines "Permalink") ## 使用计划的流水线[](#working-with-scheduled-pipelines "Permalink")
配置完成后,GitLab 将支持许多用于计划管道的功能.
### Running manually[](#running-manually "Permalink") 配置完成后,GitLab 将支持许多用于计划流水线的功能.
在 GitLab 10.4 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/15700) . ### 手动运行[](#running-manually "Permalink")
要手动触发管道计划,请单击"播放"按钮: 要手动触发流水线计划,请单击"播放"按钮:
[![Play Pipeline Schedule](img/4ffe26c8f949643669a5c295958616cf.png)](img/pipeline_schedule_play.png) [![Play Pipeline Schedule](img/4ffe26c8f949643669a5c295958616cf.png)](img/pipeline_schedule_play.png)
这将安排一个后台作业来运行管道计划. 一条简短消息将提供指向 CI / CD 管道索引页面的链接. 这将安排一个后台作业来运行流水线计划. 一条简短消息将提供指向 CI/CD 流水线索引页面的链接.
**注意:**为避免滥用,限制了用户每分钟触发一次管道的速率. **注意:**为避免滥用,限制了用户每分钟触发一次流水线的速率.
### Taking ownership[](#taking-ownership "Permalink") ### 取得所有权[](#taking-ownership "Permalink")
管道以拥有日程表的用户身份执行. 这影响管道可以访问哪些项目和其他资源. 流水线以拥有计划的用户身份执行. 这影响流水线可以访问哪些项目和其他资源.
如果用户不拥有管道,则可以通过单击" **获取所有权"**按钮**获取所有权** . 下次计划管道时,将使用您的凭据. 如果用户不拥有流水线,则可以通过单击" **获取所有权"**按钮**获取所有权** . 下次计划流水线时,将使用您的凭据.
[![Schedules list](img/94b9b90ebfb15979835f3e48d710cb45.png)](img/pipeline_schedules_ownership.png) [![Schedules list](img/94b9b90ebfb15979835f3e48d710cb45.png)](img/pipeline_schedules_ownership.png)
如果管道计划的所有者没有能力在目标分支上创建管道,则该计划将停止创建新管道. 如果流水线计划的所有者没有能力在目标分支上创建流水线,则该计划将停止创建新流水线.
例如,如果发生这种情况: 例如,如果发生这种情况:
* 所有者被阻止或从项目中删除. * 所有者被阻止或从项目中删除.
* 目标分支或标签受保护. * 目标分支或标签受保护.
在这种情况下,具有足够特权的人必须拥有日程表的所有权. 在这种情况下,具有足够特权的人必须拥有计划的所有权.
\ No newline at end of file \ No newline at end of file
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7