Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
8ac8716d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8ac8716d
编写于
12月 31, 2019
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/gitlab@master
上级
c49e17ea
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
2 deletion
+42
-2
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
changelogs/unreleased/ci-resource-group-doc.yml
changelogs/unreleased/ci-resource-group-doc.yml
+6
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+34
-0
lib/gitlab/ci/pipeline/seed/build/resource_group.rb
lib/gitlab/ci/pipeline/seed/build/resource_group.rb
+1
-1
未找到文件。
app/models/ci/build.rb
浏览文件 @
8ac8716d
...
...
@@ -481,7 +481,7 @@ module Ci
end
def
requires_resource?
Feature
.
enabled?
(
:ci_resource_group
,
project
)
&&
Feature
.
enabled?
(
:ci_resource_group
,
project
,
default_enabled:
true
)
&&
self
.
resource_group_id
.
present?
end
...
...
changelogs/unreleased/ci-resource-group-doc.yml
0 → 100644
浏览文件 @
8ac8716d
---
title
:
Add 'resource_group' keyword to .gitlab-ci.yml for pipeline job concurrency
limitation
merge_request
:
21617
author
:
type
:
added
doc/ci/yaml/README.md
浏览文件 @
8ac8716d
...
...
@@ -119,6 +119,7 @@ The following table lists available parameters for jobs:
|
[
`pages`
](
#pages
)
| Upload the result of a job to use with GitLab Pages. |
|
[
`variables`
](
#variables
)
| Define job variables on a job level. |
|
[
`interruptible`
](
#interruptible
)
| Defines if a job can be canceled when made redundant by a newer run. |
|
[
`resource_group`
](
#resource_group
)
| Limit job concurrency. |
NOTE:
**Note:**
Parameters
`types`
and
`type`
are
[
deprecated
](
#deprecated-parameters
)
.
...
...
@@ -2634,6 +2635,39 @@ In the example above, a new pipeline run will cause an existing running pipeline
NOTE:
**Note:**
Once an uninterruptible job is running, the pipeline will never be canceled, regardless of the final job's state.
### `resource_group`
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/15536) in GitLab 12.7.
Sometimes running multiples jobs or pipelines at the same time in an environment
can lead to errors during the deployment.
To avoid these errors, the
`resource_group`
attribute can be used to ensure that
the Runner will not run certain jobs simultaneously.
When the
`resource_group`
key is defined in a job in
`.gitlab-ci.yml`
,
job runs are mutually exclusive across different pipelines in the same project.
If multiple jobs belonging to the same resource group are enqueued simultaneously,
only one of them will be picked by the Runner, and the other jobs will wait until the
`resource_group`
is free.
Here is a simple example:
```
yaml
deploy-to-production
:
script
:
deploy
resource_group
:
production
```
In this case, if a
`deploy-to-production`
job is running in a pipeline, and a new
`deploy-to-production`
job is created in a different pipeline, it will not run until
the currently running/pending
`deploy-to-production`
job is finished. As a result,
you can ensure that concurrent deployments will never happen to the production environment.
There can be multiple
`resource_group`
s defined per environment. A good use case for this
is when deploying to physical devices. You may have more than one phyisical device, and each
one can be deployed to, but there can be only one deployment per device at any given time.
### `include`
> - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.5.
...
...
lib/gitlab/ci/pipeline/seed/build/resource_group.rb
浏览文件 @
8ac8716d
...
...
@@ -16,7 +16,7 @@ module Gitlab
end
def
to_resource
return
unless
Feature
.
enabled?
(
:ci_resource_group
,
build
.
project
)
return
unless
Feature
.
enabled?
(
:ci_resource_group
,
build
.
project
,
default_enabled:
true
)
return
unless
resource_group_key
.
present?
resource_group
=
build
.
project
.
resource_groups
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录