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
eaf211c2
Commit
eaf211c2
authored
Aug 25, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose compose method in the ci config entry nodes
parent
700078e8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
44 deletions
+47
-44
lib/gitlab/ci/config.rb
lib/gitlab/ci/config.rb
+1
-1
lib/gitlab/ci/config/node/configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+8
-2
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+7
-10
lib/gitlab/ci/config/node/global.rb
lib/gitlab/ci/config/node/global.rb
+5
-9
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+10
-10
lib/gitlab/ci/config/node/jobs.rb
lib/gitlab/ci/config/node/jobs.rb
+16
-12
No files found.
lib/gitlab/ci/config.rb
View file @
eaf211c2
...
@@ -14,7 +14,7 @@ module Gitlab
...
@@ -14,7 +14,7 @@ module Gitlab
@config
=
Loader
.
new
(
config
).
load!
@config
=
Loader
.
new
(
config
).
load!
@global
=
Node
::
Global
.
new
(
@config
)
@global
=
Node
::
Global
.
new
(
@config
)
@global
.
process
!
@global
.
compose
!
end
end
def
valid?
def
valid?
...
...
lib/gitlab/ci/config/node/configurable.rb
View file @
eaf211c2
...
@@ -23,9 +23,9 @@ module Gitlab
...
@@ -23,9 +23,9 @@ module Gitlab
end
end
end
end
private
def
compose!
(
deps
)
return
unless
valid?
def
compose!
(
_deps
)
self
.
class
.
nodes
.
each
do
|
key
,
factory
|
self
.
class
.
nodes
.
each
do
|
key
,
factory
|
factory
factory
.
value
(
@config
[
key
])
.
value
(
@config
[
key
])
...
@@ -33,6 +33,12 @@ module Gitlab
...
@@ -33,6 +33,12 @@ module Gitlab
@entries
[
key
]
=
factory
.
create!
@entries
[
key
]
=
factory
.
create!
end
end
yield
if
block_given?
@entries
.
each_value
do
|
entry
|
entry
.
compose!
(
deps
)
end
end
end
class_methods
do
class_methods
do
...
...
lib/gitlab/ci/config/node/entry.rb
View file @
eaf211c2
...
@@ -20,14 +20,16 @@ module Gitlab
...
@@ -20,14 +20,16 @@ module Gitlab
@validator
.
validate
(
:new
)
@validator
.
validate
(
:new
)
end
end
# Temporary method
#
def
process!
(
deps
=
nil
)
def
process!
(
deps
=
nil
)
return
unless
valid?
compose!
(
deps
)
compose!
(
deps
)
end
descendants
.
each
do
|
entry
|
def
compose!
(
deps
=
nil
)
entry
.
process!
(
deps
)
return
unless
valid?
end
yield
if
block_given?
end
end
def
leaf?
def
leaf?
...
@@ -76,11 +78,6 @@ module Gitlab
...
@@ -76,11 +78,6 @@ module Gitlab
def
self
.
validator
def
self
.
validator
Validator
Validator
end
end
private
def
compose!
(
_deps
)
end
end
end
end
end
end
end
...
...
lib/gitlab/ci/config/node/global.rb
View file @
eaf211c2
...
@@ -36,19 +36,15 @@ module Gitlab
...
@@ -36,19 +36,15 @@ module Gitlab
helpers
:before_script
,
:image
,
:services
,
:after_script
,
helpers
:before_script
,
:image
,
:services
,
:after_script
,
:variables
,
:stages
,
:types
,
:cache
,
:jobs
:variables
,
:stages
,
:types
,
:cache
,
:jobs
def
process!
(
_deps
=
nil
)
def
compose!
(
_deps
=
nil
)
super
(
self
)
super
(
self
)
do
compose_jobs!
compose_deprecated_entries!
end
end
end
private
private
def
compose!
(
_deps
)
super
compose_jobs!
compose_deprecated_entries!
end
def
compose_jobs!
def
compose_jobs!
factory
=
Node
::
Factory
.
new
(
Node
::
Jobs
)
factory
=
Node
::
Factory
.
new
(
Node
::
Jobs
)
.
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
))
.
value
(
@config
.
except
(
*
self
.
class
.
nodes
.
keys
))
...
...
lib/gitlab/ci/config/node/job.rb
View file @
eaf211c2
...
@@ -82,6 +82,16 @@ module Gitlab
...
@@ -82,6 +82,16 @@ module Gitlab
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:artifacts
:artifacts
def
compose!
(
deps
)
super
do
if
type_defined?
&&
!
stage_defined?
@entries
[
:stage
]
=
@entries
[
:type
]
end
@entries
.
delete
(
:type
)
end
end
def
name
def
name
@metadata
[
:name
]
@metadata
[
:name
]
end
end
...
@@ -106,16 +116,6 @@ module Gitlab
...
@@ -106,16 +116,6 @@ module Gitlab
artifacts:
artifacts
,
artifacts:
artifacts
,
after_script:
after_script
}
after_script:
after_script
}
end
end
def
compose!
(
_deps
)
super
if
type_defined?
&&
!
stage_defined?
@entries
[
:stage
]
=
@entries
[
:type
]
end
@entries
.
delete
(
:type
)
end
end
end
end
end
end
end
...
...
lib/gitlab/ci/config/node/jobs.rb
View file @
eaf211c2
...
@@ -26,19 +26,23 @@ module Gitlab
...
@@ -26,19 +26,23 @@ module Gitlab
name
.
to_s
.
start_with?
(
'.'
)
name
.
to_s
.
start_with?
(
'.'
)
end
end
private
def
compose!
(
deps
=
nil
)
super
do
def
compose!
(
_deps
)
@config
.
each
do
|
name
,
config
|
@config
.
each
do
|
name
,
config
|
node
=
hidden?
(
name
)
?
Node
::
HiddenJob
:
Node
::
Job
node
=
hidden?
(
name
)
?
Node
::
HiddenJob
:
Node
::
Job
factory
=
Node
::
Factory
.
new
(
node
)
factory
=
Node
::
Factory
.
new
(
node
)
.
value
(
config
||
{})
.
value
(
config
||
{})
.
metadata
(
name:
name
)
.
metadata
(
name:
name
)
.
with
(
key:
name
,
parent:
self
,
.
with
(
key:
name
,
parent:
self
,
description:
"
#{
name
}
job definition."
)
description:
"
#{
name
}
job definition."
)
@entries
[
name
]
=
factory
.
create!
end
@entries
[
name
]
=
factory
.
create!
@entries
.
each_value
do
|
entry
|
entry
.
compose!
(
deps
)
end
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