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
a02fe0d5
Commit
a02fe0d5
authored
Oct 05, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for symbol job name in need
Removes the support for specifying a job in symbol format in need.
parent
e37777e4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
23 deletions
+25
-23
lib/gitlab/ci/config/entry/need.rb
lib/gitlab/ci/config/entry/need.rb
+3
-2
lib/gitlab/ci/config/entry/needs.rb
lib/gitlab/ci/config/entry/needs.rb
+6
-0
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+1
-1
spec/lib/gitlab/ci/config/entry/need_spec.rb
spec/lib/gitlab/ci/config/entry/need_spec.rb
+0
-14
spec/lib/gitlab/ci/config/entry/needs_spec.rb
spec/lib/gitlab/ci/config/entry/needs_spec.rb
+15
-0
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+0
-6
No files found.
lib/gitlab/ci/config/entry/need.rb
View file @
a02fe0d5
...
...
@@ -5,17 +5,18 @@ module Gitlab
class
Config
module
Entry
class
Need
<
::
Gitlab
::
Config
::
Entry
::
Simplifiable
strategy
:Pipeline
,
if:
->
(
config
)
{
config
.
is_a?
(
String
)
||
config
.
is_a?
(
Symbol
)
}
strategy
:Pipeline
,
if:
->
(
config
)
{
config
.
is_a?
(
String
)
}
class
Pipeline
<
::
Gitlab
::
Config
::
Entry
::
Node
include
::
Gitlab
::
Config
::
Entry
::
Validatable
validations
do
validates
:config
,
presence:
true
validates
:config
,
type:
String
end
def
self
.
matching?
(
config
)
config
.
is_a?
(
String
)
||
config
.
is_a?
(
Symbol
)
config
.
is_a?
(
String
)
end
def
type
...
...
lib/gitlab/ci/config/entry/needs.rb
View file @
a02fe0d5
...
...
@@ -13,6 +13,12 @@ module Gitlab
validations
do
validates
:config
,
presence:
true
validate
do
unless
config
.
is_a?
(
Hash
)
||
config
.
is_a?
(
Array
)
errors
.
add
(
:config
,
'can only be a hash or an array'
)
end
end
validate
do
[
config
].
flatten
.
each
do
|
need
|
if
Needs
.
find_type
(
need
).
nil?
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
a02fe0d5
...
...
@@ -163,7 +163,7 @@ module Gitlab
stage_index
=
@stages
.
index
(
job
[
:stage
])
job
[
:needs
][
:pipeline
]
.
each
do
|
need
|
job
.
dig
(
:needs
,
:pipeline
)
.
each
do
|
need
|
need_job_name
=
need
[
:name
]
raise
ValidationError
,
"
#{
name
}
job: undefined need:
#{
need_job_name
}
"
unless
@jobs
[
need_job_name
.
to_sym
]
...
...
spec/lib/gitlab/ci/config/entry/need_spec.rb
View file @
a02fe0d5
...
...
@@ -19,20 +19,6 @@ describe ::Gitlab::Ci::Config::Entry::Need do
end
end
context
'when job is specified as symbol'
do
let
(
:config
)
{
:job_name
}
describe
'#valid?'
do
it
{
is_expected
.
to
be_valid
}
end
describe
'#value'
do
it
'returns job needs configuration'
do
expect
(
need
.
value
).
to
eq
(
name: :job_name
)
end
end
end
context
'when need is empty'
do
let
(
:config
)
{
''
}
...
...
spec/lib/gitlab/ci/config/entry/needs_spec.rb
View file @
a02fe0d5
...
...
@@ -18,6 +18,21 @@ describe ::Gitlab::Ci::Config::Entry::Needs do
end
end
context
'when config value has wrong type'
do
let
(
:config
)
{
123
}
describe
'#valid?'
do
it
{
is_expected
.
not_to
be_valid
}
end
describe
'#errors'
do
it
'returns error about incorrect type'
do
expect
(
needs
.
errors
)
.
to
include
(
'needs config can only be a hash or an array'
)
end
end
end
context
'when wrong needs type is used'
do
let
(
:config
)
{
[
123
]
}
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
a02fe0d5
...
...
@@ -1305,12 +1305,6 @@ module Gitlab
end
end
context
'needs two builds defined as symbols'
do
let
(
:needs
)
{
[
:build1
,
:build2
]
}
it
{
expect
{
subject
}.
not_to
raise_error
}
end
context
'undefined need'
do
let
(
:needs
)
{
[
'undefined'
]
}
...
...
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