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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
dff10976
Commit
dff10976
authored
Jul 20, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move job dependencies entry to the new CI config
parent
f83bccfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+10
-14
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+3
-1
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+1
-1
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
dff10976
...
...
@@ -98,21 +98,22 @@ module Ci
@jobs
=
@ci_config
.
jobs
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
# logical validation for job
validate_job_stage!
(
name
,
job
)
validate_job_dependencies!
(
name
,
job
)
end
end
def
yaml_variables
(
name
)
variables
=
global_variables
.
merge
(
job_variables
(
name
))
variables
=
(
@variables
||
{})
.
merge
(
job_variables
(
name
))
variables
.
map
do
|
key
,
value
|
{
key:
key
,
value:
value
,
public:
true
}
end
end
def
global_variables
@variables
||
{}
end
def
job_variables
(
name
)
job
=
@jobs
[
name
.
to_sym
]
return
{}
unless
job
...
...
@@ -120,21 +121,16 @@ module Ci
job
[
:variables
]
||
{}
end
def
validate_job!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
end
def
validate_job_stage!
(
name
,
job
)
return
unless
job
[
:stage
]
unless
job
[
:stage
].
is_a?
(
String
)
&&
job
[
:stage
].
in?
(
@stages
)
raise
ValidationError
,
"
#{
name
}
job: stage parameter should be
#{
@stages
.
join
(
", "
)
}
"
end
end
def
validate_job_dependencies!
(
name
,
job
)
unless
validate_array_of_strings
(
job
[
:dependencies
])
raise
ValidationError
,
"
#{
name
}
job: dependencies parameter should be an array of strings"
end
return
unless
job
[
:dependencies
]
stage_index
=
@stages
.
index
(
job
[
:stage
])
...
...
lib/gitlab/ci/config/node/job.rb
View file @
dff10976
...
...
@@ -13,7 +13,7 @@ module Gitlab
type stage when artifacts cache dependencies before_script
after_script variables environment]
attributes
:tags
,
:allow_failure
,
:when
,
:environment
attributes
:tags
,
:allow_failure
,
:when
,
:environment
,
:dependencies
validations
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
...
...
@@ -37,6 +37,8 @@ module Gitlab
format:
{
with:
Gitlab
::
Regex
.
environment_name_regex
,
message:
Gitlab
::
Regex
.
environment_name_regex_message
}
validates
:dependencies
,
array_of_strings:
true
end
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
dff10976
...
...
@@ -1239,7 +1239,7 @@ EOT
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
dependencies:
"string"
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: dependencies parameter
should be an array of strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec dependencies
should be an array of strings"
)
end
end
...
...
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