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
6ae80732
Commit
6ae80732
authored
Jul 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to define nodes in new CI config entry
parent
e00ae9a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+10
-6
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+8
-8
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
6ae80732
...
...
@@ -26,12 +26,16 @@ module Gitlab
process_nodes!
end
def
leaf?
nodes
.
none?
end
def
nodes
@nodes
.
valu
es
self
.
class
.
nod
es
end
def
leaf?
self
.
class
.
nodes
.
none?
def
descendants
@nodes
.
values
end
def
ancestors
...
...
@@ -43,7 +47,7 @@ module Gitlab
end
def
errors
@validator
.
messages
+
nod
es
.
flat_map
(
&
:errors
)
@validator
.
messages
+
@nodes
.
valu
es
.
flat_map
(
&
:errors
)
end
def
value
...
...
@@ -73,13 +77,13 @@ module Gitlab
private
def
compose!
self
.
class
.
nodes
.
each
do
|
key
,
essence
|
nodes
.
each
do
|
key
,
essence
|
@nodes
[
key
]
=
create_node
(
key
,
essence
)
end
end
def
process_nodes!
nodes
.
each
(
&
:process!
)
@nodes
.
each_value
(
&
:process!
)
end
def
create_node
(
key
,
essence
)
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
6ae80732
...
...
@@ -31,24 +31,24 @@ describe Gitlab::Ci::Config::Node::Global do
before
{
global
.
process!
}
it
'creates nodes hash'
do
expect
(
global
.
node
s
).
to
be_an
Array
expect
(
global
.
descendant
s
).
to
be_an
Array
end
it
'creates node object for each entry'
do
expect
(
global
.
node
s
.
count
).
to
eq
9
expect
(
global
.
descendant
s
.
count
).
to
eq
9
end
it
'creates node object using valid class'
do
expect
(
global
.
node
s
.
first
)
expect
(
global
.
descendant
s
.
first
)
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Script
expect
(
global
.
node
s
.
second
)
expect
(
global
.
descendant
s
.
second
)
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Image
end
it
'sets correct description for nodes'
do
expect
(
global
.
node
s
.
first
.
description
)
expect
(
global
.
descendant
s
.
first
.
description
)
.
to
eq
'Script that will be executed before each job.'
expect
(
global
.
node
s
.
second
.
description
)
expect
(
global
.
descendant
s
.
second
.
description
)
.
to
eq
'Docker image that will be used to execute jobs.'
end
end
...
...
@@ -139,11 +139,11 @@ describe Gitlab::Ci::Config::Node::Global do
describe
'#nodes'
do
it
'instantizes all nodes'
do
expect
(
global
.
node
s
.
count
).
to
eq
9
expect
(
global
.
descendant
s
.
count
).
to
eq
9
end
it
'contains undefined nodes'
do
expect
(
global
.
node
s
.
first
)
expect
(
global
.
descendant
s
.
first
)
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Undefined
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