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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6bd67f52
Commit
6bd67f52
authored
Jun 07, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not process new Ci config entry when invalid
parent
e8f995ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+6
-2
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+12
-0
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
6bd67f52
...
...
@@ -16,10 +16,14 @@ module Gitlab
keys
.
each_key
do
|
key
|
instance_variable_set
(
"@
#{
key
}
"
,
Null
.
new
(
nil
,
root
,
self
))
end
unless
leaf?
||
value
.
is_a?
(
Hash
)
@errors
<<
'should be a configuration entry with hash value'
end
end
def
process!
return
if
leaf?
return
if
leaf?
||
!
valid?
keys
.
each
do
|
key
,
entry_class
|
next
unless
@value
.
has_key?
(
key
)
...
...
@@ -42,7 +46,7 @@ module Gitlab
end
def
leaf?
keys
.
none?
# TODO || !@value.is_a?(Hash)
keys
.
none?
end
def
keys
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
6bd67f52
...
...
@@ -58,4 +58,16 @@ describe Gitlab::Ci::Config::Node::Global do
end
end
end
context
'when value is not a hash'
do
let
(
:hash
)
{
[]
}
before
{
global
.
process!
}
describe
'#valid?'
do
it
'is not valid'
do
expect
(
global
).
not_to
be_valid
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