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
0ccf6295
Commit
0ccf6295
authored
Apr 21, 2016
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the GitlabCiYamlProcessor#initial_parsing method
parent
e1b3ce54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+11
-16
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
0ccf6295
...
@@ -61,28 +61,23 @@ module Ci
...
@@ -61,28 +61,23 @@ module Ci
@stages
=
@config
[
:stages
]
||
@config
[
:types
]
@stages
=
@config
[
:stages
]
||
@config
[
:types
]
@variables
=
@config
[
:variables
]
||
{}
@variables
=
@config
[
:variables
]
||
{}
@cache
=
@config
[
:cache
]
@cache
=
@config
[
:cache
]
@
config
.
except!
(
*
ALLOWED_YAML_KEYS
)
@
jobs
=
{}
@config
.
except!
(
*
ALLOWED_YAML_KEYS
)
@config
.
each
do
|
name
,
param
|
@config
.
each
do
|
name
,
param
|
raise
ValidationError
,
"Unknown parameter:
#{
name
}
"
unless
is_a_job?
(
name
,
param
)
add_job
(
name
,
param
)
end
unless
@config
.
values
.
any?
{
|
job
|
job
.
is_a?
(
Hash
)}
raise
ValidationError
,
"Please define at least one job"
end
end
@jobs
=
{}
raise
ValidationError
,
"Please define at least one job"
if
@jobs
.
none?
@config
.
each
do
|
key
,
job
|
next
if
key
.
to_s
.
start_with?
(
'.'
)
stage
=
job
[
:stage
]
||
job
[
:type
]
||
DEFAULT_STAGE
@jobs
[
key
]
=
{
stage:
stage
}.
merge
(
job
)
end
end
end
def
is_a_job?
(
name
,
value
)
def
add_job
(
name
,
job
)
return
true
if
value
.
is_a?
(
Hash
)
&&
value
.
has_key?
(
:script
)
return
if
name
.
to_s
.
start_with?
(
'.'
)
return
true
if
name
.
to_s
.
start_with?
(
'.'
)
false
raise
ValidationError
,
"Unknown parameter:
#{
name
}
"
unless
job
.
is_a?
(
Hash
)
&&
job
.
has_key?
(
:script
)
stage
=
job
[
:stage
]
||
job
[
:type
]
||
DEFAULT_STAGE
@jobs
[
name
]
=
{
stage:
stage
}.
merge
(
job
)
end
end
def
build_job
(
name
,
job
)
def
build_job
(
name
,
job
)
...
...
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