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
7eb70c63
Commit
7eb70c63
authored
Oct 06, 2020
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make parent_validations work
parent
7398edf6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
lib/gitlab/ci/config/entry/jobs.rb
lib/gitlab/ci/config/entry/jobs.rb
+0
-2
lib/gitlab/config/entry/composable_hash.rb
lib/gitlab/config/entry/composable_hash.rb
+8
-4
lib/gitlab/config/entry/node.rb
lib/gitlab/config/entry/node.rb
+2
-0
lib/gitlab/config/entry/validatable.rb
lib/gitlab/config/entry/validatable.rb
+0
-2
No files found.
lib/gitlab/ci/config/entry/jobs.rb
View file @
7eb70c63
...
...
@@ -11,8 +11,6 @@ module Gitlab
include
::
Gitlab
::
Config
::
Entry
::
Validatable
validations
do
validates
:config
,
type:
Hash
validate
do
each_unmatched_job
do
|
name
|
errors
.
add
(
name
,
'config should implement a script: or a trigger: keyword'
)
...
...
lib/gitlab/config/entry/composable_hash.rb
View file @
7eb70c63
...
...
@@ -10,17 +10,21 @@ module Gitlab
class
ComposableHash
<
::
Gitlab
::
Config
::
Entry
::
Node
include
::
Gitlab
::
Config
::
Entry
::
Validatable
validations
do
validates
:config
,
type:
Hash
def
self
.
parent_validations
validations
do
validates
:config
,
type:
Hash
end
end
parent_validations
def
compose!
(
deps
=
nil
)
super
do
@config
.
each
do
|
name
,
config
|
entry_class
=
composable_class
(
name
,
config
)
raise
ArgumentError
,
'Missing Composable class'
unless
entry_class
entry_class_name
=
entry_class
.
name
.
split
(
'::'
).
last
.
downcas
e
entry_class_name
=
entry_class
.
name
.
demodulize
.
underscor
e
factory
=
::
Gitlab
::
Config
::
Entry
::
Factory
.
new
(
entry_class
)
.
value
(
config
||
{})
...
...
@@ -36,7 +40,7 @@ module Gitlab
end
end
def
composable_class
(
name
=
nil
,
config
=
nil
)
def
composable_class
(
name
,
config
)
opt
(
:composable_class
)
end
end
...
...
lib/gitlab/config/entry/node.rb
View file @
7eb70c63
...
...
@@ -20,6 +20,8 @@ module Gitlab
yield
(
self
)
if
block_given?
self
.
class
.
parent_validations
if
self
.
class
.
respond_to?
(
:parent_validations
)
self
.
class
.
aspects
.
to_a
.
each
do
|
aspect
|
instance_exec
(
&
aspect
)
end
...
...
lib/gitlab/config/entry/validatable.rb
View file @
7eb70c63
...
...
@@ -39,8 +39,6 @@ module Gitlab
end
end
private
def
validations
(
&
block
)
(
@validations
||=
[]).
append
(
block
)
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