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
Boxiang Sun
gitlab-ce
Commits
eedebb2b
Commit
eedebb2b
authored
Sep 05, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs and error messages in extendable config
parent
7efef550
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
6 deletions
+33
-6
lib/gitlab/ci/config/extendable/entry.rb
lib/gitlab/ci/config/extendable/entry.rb
+2
-2
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
+1
-1
spec/lib/gitlab/ci/config/extendable_spec.rb
spec/lib/gitlab/ci/config/extendable_spec.rb
+29
-2
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+1
-1
No files found.
lib/gitlab/ci/config/extendable/entry.rb
View file @
eedebb2b
...
...
@@ -50,7 +50,7 @@ module Gitlab
if
unknown_extension?
raise
Entry
::
InvalidExtensionError
,
"
#{
key
}
: unknown
`extends` key
"
"
#{
key
}
: unknown
key in `extends`
"
end
if
invalid_base?
...
...
@@ -60,7 +60,7 @@ module Gitlab
if
nesting_too_deep?
raise
Entry
::
NestingTooDeepError
,
"
#{
key
}
:
`extends` nesting too deep
"
"
#{
key
}
:
nesting too deep in `extends`
"
end
if
circular_dependency?
...
...
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
View file @
eedebb2b
...
...
@@ -139,7 +139,7 @@ describe Gitlab::Ci::Config::Extendable::Entry do
it
'raises an error'
do
expect
{
subject
.
extend!
}
.
to
raise_error
(
described_class
::
InvalidExtensionError
,
/unknown
`extends`
key/
)
/unknown key/
)
end
end
...
...
spec/lib/gitlab/ci/config/extendable_spec.rb
View file @
eedebb2b
...
...
@@ -80,9 +80,19 @@ describe Gitlab::Ci::Config::Extendable do
only:
{
refs:
%w[master]
}
},
build:
{
extends:
'something'
,
stage:
'build'
},
deploy:
{
stage:
'deploy'
,
extends:
'.first'
},
something:
{
extends:
'.first'
,
script:
'
deploy
'
,
script:
'
exec
'
,
only:
{
variables:
%w[$SOMETHING]
}
},
...
...
@@ -102,7 +112,24 @@ describe Gitlab::Ci::Config::Extendable do
something:
{
extends:
'.first'
,
script:
'deploy'
,
script:
'exec'
,
only:
{
kubernetes:
'active'
,
variables:
%w[$SOMETHING]
}
},
deploy:
{
script:
'run'
,
stage:
'deploy'
,
only:
{
kubernetes:
'active'
},
extends:
'.first'
},
build:
{
extends:
'something'
,
script:
'exec'
,
stage:
'build'
,
only:
{
kubernetes:
'active'
,
variables:
%w[$SOMETHING]
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
eedebb2b
...
...
@@ -1367,7 +1367,7 @@ module Gitlab
expect
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
config
)
}
.
to
raise_error
(
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
,
'rspec: unknown
`extends` key
'
)
'rspec: unknown
key in `extends`
'
)
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