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
bce723f0
Commit
bce723f0
authored
Nov 02, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds validation to job length
parent
7f9a6419
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
1 deletion
+22
-1
config/feature_flags/development/ci_validate_job_length.yml
config/feature_flags/development/ci_validate_job_length.yml
+8
-0
doc/ci/jobs/index.md
doc/ci/jobs/index.md
+5
-1
lib/gitlab/ci/config/entry/processable.rb
lib/gitlab/ci/config/entry/processable.rb
+1
-0
spec/lib/gitlab/ci/config/entry/processable_spec.rb
spec/lib/gitlab/ci/config/entry/processable_spec.rb
+8
-0
No files found.
config/feature_flags/development/ci_validate_job_length.yml
0 → 100644
View file @
bce723f0
---
name
:
ci_validate_job_length
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73599
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/344665
milestone
:
'
14.5'
type
:
development
group
:
group::pipeline authoring
default_enabled
:
true
doc/ci/jobs/index.md
View file @
bce723f0
...
@@ -82,7 +82,7 @@ For example:
...
@@ -82,7 +82,7 @@ For example:
![
Pipeline mini graph sorting
](
img/pipelines_mini_graph_sorting.png
)
![
Pipeline mini graph sorting
](
img/pipelines_mini_graph_sorting.png
)
##
Unavailable names for job
s
##
Job name limitation
s
You can't use these keywords as job names:
You can't use these keywords as job names:
...
@@ -96,6 +96,10 @@ You can't use these keywords as job names:
...
@@ -96,6 +96,10 @@ You can't use these keywords as job names:
-
`cache`
-
`cache`
-
`include`
-
`include`
Job names must be 255 characters or less.
[
Introduced
](
https://gitlab.com/gitlab-org/gitlab/-/issues/342800
)
in GitLab 14.5,
[
with a feature flag
](
../../administration/feature_flags.md
)
named
`ci_validate_job_length`
.
Enabled by default. To disable it, ask an administrator to
[
disable the feature flag
](
../../administration/feature_flags.md
)
.
## Group jobs in a pipeline
## Group jobs in a pipeline
If you have many similar jobs, your
[
pipeline graph
](
../pipelines/index.md#visualize-pipelines
)
becomes long and hard
If you have many similar jobs, your
[
pipeline graph
](
../pipelines/index.md#visualize-pipelines
)
becomes long and hard
...
...
lib/gitlab/ci/config/entry/processable.rb
View file @
bce723f0
...
@@ -23,6 +23,7 @@ module Gitlab
...
@@ -23,6 +23,7 @@ module Gitlab
validates
:config
,
presence:
true
validates
:config
,
presence:
true
validates
:name
,
presence:
true
validates
:name
,
presence:
true
validates
:name
,
type:
Symbol
validates
:name
,
type:
Symbol
validates
:name
,
length:
{
maximum:
255
},
if:
->
{
::
Feature
.
enabled?
(
:ci_validate_job_length
,
default_enabled: :yaml
)
}
validates
:config
,
disallowed_keys:
{
validates
:config
,
disallowed_keys:
{
in:
%i[only except when start_in]
,
in:
%i[only except when start_in]
,
...
...
spec/lib/gitlab/ci/config/entry/processable_spec.rb
View file @
bce723f0
...
@@ -33,6 +33,14 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
...
@@ -33,6 +33,14 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
end
end
end
end
context
'when job name is more than 255'
do
let
(
:entry
)
{
node_class
.
new
(
config
,
name:
(
'a'
*
256
).
to_sym
)
}
it
'shows a validation error'
do
expect
(
entry
.
errors
).
to
include
"job name is too long (maximum is 255 characters)"
end
end
context
'when job name is empty'
do
context
'when job name is empty'
do
let
(
:entry
)
{
node_class
.
new
(
config
,
name:
''
.
to_sym
)
}
let
(
:entry
)
{
node_class
.
new
(
config
,
name:
''
.
to_sym
)
}
...
...
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