Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
17e90416
Commit
17e90416
authored
Dec 31, 2019
by
Shinya Maeda
Committed by
Ash McKenzie
Dec 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs for Ci Resource Group
This commit adds docs for Ci resource group
parent
1f6f0606
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
2 deletions
+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
No files found.
app/models/ci/build.rb
View file @
17e90416
...
@@ -481,7 +481,7 @@ module Ci
...
@@ -481,7 +481,7 @@ module Ci
end
end
def
requires_resource?
def
requires_resource?
Feature
.
enabled?
(
:ci_resource_group
,
project
)
&&
Feature
.
enabled?
(
:ci_resource_group
,
project
,
default_enabled:
true
)
&&
self
.
resource_group_id
.
present?
self
.
resource_group_id
.
present?
end
end
...
...
changelogs/unreleased/ci-resource-group-doc.yml
0 → 100644
View file @
17e90416
---
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
View file @
17e90416
...
@@ -119,6 +119,7 @@ The following table lists available parameters for jobs:
...
@@ -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. |
|
[
`pages`
](
#pages
)
| Upload the result of a job to use with GitLab Pages. |
|
[
`variables`
](
#variables
)
| Define job variables on a job level. |
|
[
`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. |
|
[
`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:**
NOTE:
**Note:**
Parameters
`types`
and
`type`
are
[
deprecated
](
#deprecated-parameters
)
.
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
...
@@ -2634,6 +2635,39 @@ In the example above, a new pipeline run will cause an existing running pipeline
NOTE:
**Note:**
NOTE:
**Note:**
Once an uninterruptible job is running, the pipeline will never be canceled, regardless of the final job's state.
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`
### `include`
> - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.5.
> - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.5.
...
...
lib/gitlab/ci/pipeline/seed/build/resource_group.rb
View file @
17e90416
...
@@ -16,7 +16,7 @@ module Gitlab
...
@@ -16,7 +16,7 @@ module Gitlab
end
end
def
to_resource
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?
return
unless
resource_group_key
.
present?
resource_group
=
build
.
project
.
resource_groups
resource_group
=
build
.
project
.
resource_groups
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment