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
b83fa58f
Commit
b83fa58f
authored
Sep 05, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve extended CI/CD config error messages
parent
d7133d94
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
lib/gitlab/ci/config/extendable/entry.rb
lib/gitlab/ci/config/extendable/entry.rb
+6
-6
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
+5
-3
spec/lib/gitlab/ci/config_spec.rb
spec/lib/gitlab/ci/config_spec.rb
+1
-1
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 @
b83fa58f
...
...
@@ -3,12 +3,12 @@ module Gitlab
class
Config
class
Extendable
class
Entry
MAX_NESTING_LEVELS
=
10
InvalidExtensionError
=
Class
.
new
(
Extendable
::
ExtensionError
)
CircularDependencyError
=
Class
.
new
(
Extendable
::
ExtensionError
)
NestingTooDeepError
=
Class
.
new
(
Extendable
::
ExtensionError
)
MAX_NESTING_LEVELS
=
10
attr_reader
:key
def
initialize
(
key
,
context
,
parent
=
nil
)
...
...
@@ -48,22 +48,22 @@ module Gitlab
if
unknown_extension?
raise
Entry
::
InvalidExtensionError
,
"
Unknown extends key in extended `
#{
key
}
`!
"
"
#{
key
}
: unknown `extends` key
"
end
if
invalid_base?
raise
Entry
::
InvalidExtensionError
,
"
Invalid base hash in extended `
#{
key
}
`!
"
"
#{
key
}
: invalid base hash in `extends`
"
end
if
nesting_too_deep?
raise
Entry
::
NestingTooDeepError
,
"
`extends` nesting too deep in `
#{
key
}
`!
"
"
#{
key
}
: `extends` nesting too deep
"
end
if
circular_dependency?
raise
Entry
::
CircularDependencyError
,
"
Circular dependency detected in extended `
#{
key
}
`!
"
"
#{
key
}
: circular dependency detected in `extends`
"
end
@context
[
key
]
=
base_hash!
.
deep_merge
(
value
)
...
...
spec/lib/gitlab/ci/config/extendable/entry_spec.rb
View file @
b83fa58f
...
...
@@ -126,7 +126,8 @@ describe Gitlab::Ci::Config::Extendable::Entry do
it
'raises an error'
do
expect
{
subject
.
extend!
}
.
to
raise_error
(
StandardError
,
/Invalid base hash/
)
.
to
raise_error
(
described_class
::
InvalidExtensionError
,
/invalid base hash/
)
end
end
...
...
@@ -137,7 +138,8 @@ describe Gitlab::Ci::Config::Extendable::Entry do
it
'raises an error'
do
expect
{
subject
.
extend!
}
.
to
raise_error
(
StandardError
,
/Unknown extends key/
)
.
to
raise_error
(
described_class
::
InvalidExtensionError
,
/unknown `extends` key/
)
end
end
...
...
@@ -199,7 +201,7 @@ describe Gitlab::Ci::Config::Extendable::Entry do
it
'raises an error'
do
expect
{
subject
.
extend!
}
.
to
raise_error
(
described_class
::
CircularDependencyError
,
/
C
ircular dependency detected/
)
/
c
ircular dependency detected/
)
end
end
...
...
spec/lib/gitlab/ci/config_spec.rb
View file @
b83fa58f
...
...
@@ -119,7 +119,7 @@ describe Gitlab::Ci::Config do
it
'raises an error'
do
expect
{
config
}.
to
raise_error
(
described_class
::
ConfigError
,
/
C
ircular dependency detected/
described_class
::
ConfigError
,
/
c
ircular dependency detected/
)
end
end
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
b83fa58f
...
...
@@ -1367,7 +1367,7 @@ module Gitlab
expect
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
config
)
}
.
to
raise_error
(
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
,
'
Unknown extends key in extended `rspec`!
'
)
'
rspec: unknown `extends` key
'
)
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