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
iv
gitlab-ce
Commits
1f320edb
Commit
1f320edb
authored
Jun 23, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactorings in new CI configuration classes
parent
29b96d92
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
6 deletions
+10
-6
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+5
-0
lib/gitlab/ci/config/node/configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+1
-1
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+1
-2
lib/gitlab/ci/config/node/validator.rb
lib/gitlab/ci/config/node/validator.rb
+1
-1
spec/lib/gitlab/ci/config/node/validator_spec.rb
spec/lib/gitlab/ci/config/node/validator_spec.rb
+2
-2
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
1f320edb
...
@@ -91,6 +91,11 @@ module Ci
...
@@ -91,6 +91,11 @@ module Ci
{
{
stage_idx:
@stages
.
index
(
job
[
:stage
]),
stage_idx:
@stages
.
index
(
job
[
:stage
]),
stage:
job
[
:stage
],
stage:
job
[
:stage
],
##
# Refactoring note:
# - before script behaves differently than after script
# - after script returns an array of commands
# - before script should be a concatenated command
commands:
[
job
[
:before_script
]
||
@before_script
,
job
[
:script
]].
flatten
.
compact
.
join
(
"
\n
"
),
commands:
[
job
[
:before_script
]
||
@before_script
,
job
[
:script
]].
flatten
.
compact
.
join
(
"
\n
"
),
tag_list:
job
[
:tags
]
||
[],
tag_list:
job
[
:tags
]
||
[],
name:
name
,
name:
name
,
...
...
lib/gitlab/ci/config/node/configurable.rb
View file @
1f320edb
...
@@ -52,7 +52,7 @@ module Gitlab
...
@@ -52,7 +52,7 @@ module Gitlab
factory
=
Node
::
Factory
.
new
(
entry_class
)
factory
=
Node
::
Factory
.
new
(
entry_class
)
.
with
(
description:
metadata
[
:description
])
.
with
(
description:
metadata
[
:description
])
(
@nodes
||=
{}).
merge!
(
symbol
=>
factory
)
(
@nodes
||=
{}).
merge!
(
symbol
.
to_sym
=>
factory
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/config/node/entry.rb
View file @
1f320edb
...
@@ -44,8 +44,7 @@ module Gitlab
...
@@ -44,8 +44,7 @@ module Gitlab
end
end
def
errors
def
errors
@validator
.
full_errors
+
@validator
.
messages
+
nodes
.
flat_map
(
&
:errors
)
nodes
.
map
(
&
:errors
).
flatten
end
end
def
value
def
value
...
...
lib/gitlab/ci/config/node/validator.rb
View file @
1f320edb
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
@node
=
node
@node
=
node
end
end
def
full_error
s
def
message
s
errors
.
full_messages
.
map
do
|
error
|
errors
.
full_messages
.
map
do
|
error
|
"
#{
@node
.
key
}
#{
error
}
"
.
humanize
"
#{
@node
.
key
}
#{
error
}
"
.
humanize
end
end
...
...
spec/lib/gitlab/ci/config/node/validator_spec.rb
View file @
1f320edb
...
@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::Node::Validator do
...
@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::Node::Validator do
it
'returns no errors'
do
it
'returns no errors'
do
validator_instance
.
validate
validator_instance
.
validate
expect
(
validator_instance
.
full_error
s
).
to
be_empty
expect
(
validator_instance
.
message
s
).
to
be_empty
end
end
end
end
...
@@ -36,7 +36,7 @@ describe Gitlab::Ci::Config::Node::Validator do
...
@@ -36,7 +36,7 @@ describe Gitlab::Ci::Config::Node::Validator do
it
'returns errors'
do
it
'returns errors'
do
validator_instance
.
validate
validator_instance
.
validate
expect
(
validator_instance
.
full_error
s
).
not_to
be_empty
expect
(
validator_instance
.
message
s
).
not_to
be_empty
end
end
end
end
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