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
30e946ce
Commit
30e946ce
authored
Jun 14, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate ci config entry value before processing nodes
parent
59eeec3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
lib/gitlab/ci/config/node/configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+6
-8
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+5
-0
No files found.
lib/gitlab/ci/config/node/configurable.rb
View file @
30e946ce
...
...
@@ -16,20 +16,18 @@ module Gitlab
module
Configurable
extend
ActiveSupport
::
Concern
def
initialize
(
*
)
super
unless
@value
.
is_a?
(
Hash
)
@errors
<<
'should be a configuration entry with hash value'
end
end
def
allowed_nodes
self
.
class
.
allowed_nodes
||
{}
end
private
def
prevalidate!
unless
@value
.
is_a?
(
Hash
)
@errors
<<
'should be a configuration entry with hash value'
end
end
def
create_node
(
key
,
factory
)
factory
.
with
(
value:
@value
[
key
])
factory
.
nullify!
unless
@value
.
has_key?
(
key
)
...
...
lib/gitlab/ci/config/node/entry.rb
View file @
30e946ce
...
...
@@ -14,6 +14,8 @@ module Gitlab
@value
=
value
@nodes
=
{}
@errors
=
[]
prevalidate!
end
def
process!
...
...
@@ -56,6 +58,9 @@ module Gitlab
private
def
prevalidate!
end
def
compose!
allowed_nodes
.
each
do
|
key
,
essence
|
@nodes
[
key
]
=
create_node
(
key
,
essence
)
...
...
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