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
e6e812e2
Commit
e6e812e2
authored
Mar 04, 2020
by
Fabio Pitino
Committed by
Kamil Trzciński
Mar 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `Configurable#helpers` method
Simplify configurations by defining helpers by default
parent
8da519a8
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
43 additions
and
30 deletions
+43
-30
ee/lib/gitlab/web_ide/config/entry/global.rb
ee/lib/gitlab/web_ide/config/entry/global.rb
+0
-2
ee/lib/gitlab/web_ide/config/entry/terminal.rb
ee/lib/gitlab/web_ide/config/entry/terminal.rb
+0
-2
lib/gitlab/ci/config/entry/artifacts.rb
lib/gitlab/ci/config/entry/artifacts.rb
+0
-2
lib/gitlab/ci/config/entry/bridge.rb
lib/gitlab/ci/config/entry/bridge.rb
+0
-2
lib/gitlab/ci/config/entry/cache.rb
lib/gitlab/ci/config/entry/cache.rb
+0
-2
lib/gitlab/ci/config/entry/default.rb
lib/gitlab/ci/config/entry/default.rb
+0
-2
lib/gitlab/ci/config/entry/job.rb
lib/gitlab/ci/config/entry/job.rb
+0
-5
lib/gitlab/ci/config/entry/processable.rb
lib/gitlab/ci/config/entry/processable.rb
+0
-2
lib/gitlab/ci/config/entry/release.rb
lib/gitlab/ci/config/entry/release.rb
+0
-2
lib/gitlab/ci/config/entry/release/assets.rb
lib/gitlab/ci/config/entry/release/assets.rb
+0
-2
lib/gitlab/ci/config/entry/root.rb
lib/gitlab/ci/config/entry/root.rb
+1
-3
lib/gitlab/ci/config/entry/service.rb
lib/gitlab/ci/config/entry/service.rb
+32
-2
lib/gitlab/config/entry/configurable.rb
lib/gitlab/config/entry/configurable.rb
+10
-2
No files found.
ee/lib/gitlab/web_ide/config/entry/global.rb
View file @
e6e812e2
...
...
@@ -21,8 +21,6 @@ module Gitlab
entry
:terminal
,
Entry
::
Terminal
,
description:
'Configuration of the webide terminal.'
helpers
:terminal
attributes
:terminal
end
end
...
...
ee/lib/gitlab/web_ide/config/entry/terminal.rb
View file @
e6e812e2
...
...
@@ -42,8 +42,6 @@ module Gitlab
entry
:variables
,
::
Gitlab
::
Ci
::
Config
::
Entry
::
Variables
,
description:
'Environment variables available for this job.'
helpers
:before_script
,
:script
,
:image
,
:variables
,
:services
attributes
:tags
def
value
...
...
lib/gitlab/ci/config/entry/artifacts.rb
View file @
e6e812e2
...
...
@@ -44,8 +44,6 @@ module Gitlab
end
end
helpers
:reports
def
value
@config
[
:reports
]
=
reports_value
if
@config
.
key?
(
:reports
)
@config
...
...
lib/gitlab/ci/config/entry/bridge.rb
View file @
e6e812e2
...
...
@@ -49,8 +49,6 @@ module Gitlab
description:
'Environment variables available for this job.'
,
inherit:
false
helpers
:trigger
,
:needs
,
:variables
attributes
:when
,
:allow_failure
def
self
.
matching?
(
name
,
config
)
...
...
lib/gitlab/ci/config/entry/cache.rb
View file @
e6e812e2
...
...
@@ -28,8 +28,6 @@ module Gitlab
entry
:paths
,
Entry
::
Paths
,
description:
'Specify which paths should be cached across builds.'
helpers
:key
attributes
:policy
def
value
...
...
lib/gitlab/ci/config/entry/default.rb
View file @
e6e812e2
...
...
@@ -61,8 +61,6 @@ module Gitlab
description:
'Default artifacts.'
,
inherit:
false
helpers
:before_script
,
:image
,
:services
,
:after_script
,
:cache
private
def
overwrite_entry
(
deps
,
key
,
current_entry
)
...
...
lib/gitlab/ci/config/entry/job.rb
View file @
e6e812e2
...
...
@@ -128,11 +128,6 @@ module Gitlab
description:
'This job will produce a release.'
,
inherit:
false
helpers
:before_script
,
:script
,
:type
,
:after_script
,
:cache
,
:image
,
:services
,
:variables
,
:artifacts
,
:environment
,
:coverage
,
:retry
,
:needs
,
:interruptible
,
:release
,
:tags
attributes
:script
,
:tags
,
:allow_failure
,
:when
,
:dependencies
,
:needs
,
:retry
,
:parallel
,
:start_in
,
:interruptible
,
:timeout
,
:resource_group
,
:release
...
...
lib/gitlab/ci/config/entry/processable.rb
View file @
e6e812e2
...
...
@@ -54,8 +54,6 @@ module Gitlab
allowed_when:
%w[on_success on_failure always never manual delayed]
.
freeze
}
helpers
:stage
,
:only
,
:except
,
:rules
attributes
:extends
,
:rules
end
...
...
lib/gitlab/ci/config/entry/release.rb
View file @
e6e812e2
...
...
@@ -33,8 +33,6 @@ module Gitlab
validates
:description
,
type:
String
,
presence:
true
end
helpers
:assets
def
value
@config
[
:assets
]
=
assets_value
if
@config
.
key?
(
:assets
)
@config
...
...
lib/gitlab/ci/config/entry/release/assets.rb
View file @
e6e812e2
...
...
@@ -23,8 +23,6 @@ module Gitlab
validates
:links
,
array_of_hashes:
true
,
presence:
true
end
helpers
:links
def
value
@config
[
:links
]
=
links_value
if
@config
.
key?
(
:links
)
@config
...
...
lib/gitlab/ci/config/entry/root.rb
View file @
e6e812e2
...
...
@@ -67,9 +67,7 @@ module Gitlab
entry
:workflow
,
Entry
::
Workflow
,
description:
'List of evaluable rules to determine Pipeline status'
helpers
:default
,
:stages
,
:types
,
:variables
,
:workflow
helpers
:jobs
,
dynamic:
true
dynamic_helpers
:jobs
delegate
:before_script_value
,
:image_value
,
...
...
lib/gitlab/ci/config/entry/service.rb
View file @
e6e812e2
...
...
@@ -7,8 +7,13 @@ module Gitlab
##
# Entry that represents a configuration of Docker service.
#
class
Service
<
Image
# TODO: remove duplication with Image superclass by defining a common
# Imageable concern.
# https://gitlab.com/gitlab-org/gitlab/issues/208774
class
Service
<
::
Gitlab
::
Config
::
Entry
::
Node
include
::
Gitlab
::
Config
::
Entry
::
Validatable
include
::
Gitlab
::
Config
::
Entry
::
Attributable
include
::
Gitlab
::
Config
::
Entry
::
Configurable
ALLOWED_KEYS
=
%i[name entrypoint command alias ports]
.
freeze
...
...
@@ -16,9 +21,9 @@ module Gitlab
validates
:config
,
hash_or_string:
true
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:config
,
disallowed_keys:
%i[ports]
,
unless: :with_image_ports?
validates
:name
,
type:
String
,
presence:
true
validates
:entrypoint
,
array_of_strings:
true
,
allow_nil:
true
validates
:command
,
array_of_strings:
true
,
allow_nil:
true
validates
:alias
,
type:
String
,
allow_nil:
true
validates
:alias
,
type:
String
,
presence:
true
,
unless:
->
(
record
)
{
record
.
ports
.
blank?
}
...
...
@@ -27,6 +32,8 @@ module Gitlab
entry
:ports
,
Entry
::
Ports
,
description:
'Ports used to expose the service'
attributes
:ports
def
alias
value
[
:alias
]
end
...
...
@@ -34,6 +41,29 @@ module Gitlab
def
command
value
[
:command
]
end
def
name
value
[
:name
]
end
def
entrypoint
value
[
:entrypoint
]
end
def
value
return
{
name:
@config
}
if
string?
return
@config
if
hash
?
{}
end
def
with_image_ports?
opt
(:
with_image_ports
)
end
def
skip_config_hash_validation?
true
end
end
end
end
...
...
lib/gitlab/config/entry/configurable.rb
View file @
e6e812e2
...
...
@@ -75,7 +75,8 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def
entry
(
key
,
entry
,
description:
nil
,
default:
nil
,
inherit:
nil
,
reserved:
nil
,
metadata:
{})
raise
ArgumentError
,
"Entry
#{
key
}
already defined"
if
@nodes
.
to_h
[
key
.
to_sym
]
entry_name
=
key
.
to_sym
raise
ArgumentError
,
"Entry
#{
key
}
already defined"
if
@nodes
.
to_h
[
entry_name
]
factory
=
::
Gitlab
::
Config
::
Entry
::
Factory
.
new
(
entry
)
.
with
(
description:
description
)
...
...
@@ -84,10 +85,17 @@ module Gitlab
.
with
(
reserved:
reserved
)
.
metadata
(
metadata
)
(
@nodes
||=
{}).
merge!
(
key
.
to_sym
=>
factory
)
@nodes
||=
{}
@nodes
[
entry_name
]
=
factory
helpers
(
entry_name
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
dynamic_helpers
(
*
nodes
)
helpers
(
*
nodes
,
dynamic:
true
)
end
def
helpers
(
*
nodes
,
dynamic:
false
)
nodes
.
each
do
|
symbol
|
if
method_defined?
(
"
#{
symbol
}
_defined?"
)
||
method_defined?
(
"
#{
symbol
}
_value"
)
...
...
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