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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
6a319fd2
Commit
6a319fd2
authored
Jun 09, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible configure Ci entry description
parent
d9d5042f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
16 deletions
+23
-16
lib/gitlab/ci/config/node/configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+14
-7
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+2
-4
lib/gitlab/ci/config/node/global.rb
lib/gitlab/ci/config/node/global.rb
+2
-1
lib/gitlab/ci/config/node/script.rb
lib/gitlab/ci/config/node/script.rb
+0
-4
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+5
-0
No files found.
lib/gitlab/ci/config/node/configurable.rb
View file @
6a319fd2
...
...
@@ -11,14 +11,19 @@ module Gitlab
private
def
add_node
(
key
,
entry_class
)
def
add_node
(
key
,
metadata
)
entry
=
create_entry
(
key
,
metadata
[
:class
])
entry
.
description
=
metadata
[
:description
]
@nodes
[
key
]
=
entry
end
def
create_entry
(
key
,
entry_class
)
if
@value
.
has_key?
(
key
)
entry
=
entry
_class
.
new
(
@value
[
key
],
@root
,
self
)
entry_class
.
new
(
@value
[
key
],
@root
,
self
)
else
entry
=
Node
::
Null
.
new
(
nil
,
@root
,
self
)
Node
::
Null
.
new
(
nil
,
@root
,
self
)
end
@nodes
[
key
]
=
entry
end
class_methods
do
...
...
@@ -26,8 +31,10 @@ module Gitlab
private
def
add_node
(
symbol
,
entry_class
)
node
=
{
symbol
.
to_sym
=>
entry_class
}
def
add_node
(
symbol
,
entry_class
,
metadata
)
node
=
{
symbol
.
to_sym
=>
{
class:
entry_class
,
description:
metadata
[
:description
]
}
}
(
@nodes
||=
{}).
merge!
(
node
)
end
...
...
lib/gitlab/ci/config/node/entry.rb
View file @
6a319fd2
...
...
@@ -5,6 +5,8 @@ module Gitlab
class
Entry
class
InvalidError
<
StandardError
;
end
attr_accessor
:description
def
initialize
(
value
,
root
=
nil
,
parent
=
nil
)
@value
=
value
@root
=
root
...
...
@@ -78,10 +80,6 @@ module Gitlab
def
validate!
raise
NotImplementedError
end
def
description
raise
NotImplementedError
end
end
end
end
...
...
lib/gitlab/ci/config/node/global.rb
View file @
6a319fd2
...
...
@@ -5,7 +5,8 @@ module Gitlab
class
Global
<
Entry
include
Configurable
add_node
:before_script
,
Script
add_node
:before_script
,
Script
,
description:
'Script that will be executed before each job.'
end
end
end
...
...
lib/gitlab/ci/config/node/script.rb
View file @
6a319fd2
...
...
@@ -5,10 +5,6 @@ module Gitlab
class
Script
<
Entry
include
ValidationHelpers
def
description
'Script that is executed before the one defined in a job.'
end
def
value
@value
.
join
(
"
\n
"
)
end
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
6a319fd2
...
...
@@ -42,6 +42,11 @@ describe Gitlab::Ci::Config::Node::Global do
expect
(
global
.
nodes
.
first
)
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Script
end
it
'sets correct description for nodes'
do
expect
(
global
.
nodes
.
first
.
description
)
.
to
eq
'Script that will be executed before each job.'
end
end
describe
'#has_config?'
do
...
...
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