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
e26a30e5
Commit
e26a30e5
authored
Oct 22, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error message when `include` is blocked
parent
380f63bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
lib/gitlab/ci/config/external/file/remote.rb
lib/gitlab/ci/config/external/file/remote.rb
+3
-5
spec/lib/gitlab/ci/config/external/file/remote_spec.rb
spec/lib/gitlab/ci/config/external/file/remote_spec.rb
+9
-0
No files found.
lib/gitlab/ci/config/external/file/remote.rb
View file @
e26a30e5
...
@@ -31,14 +31,12 @@ module Gitlab
...
@@ -31,14 +31,12 @@ module Gitlab
errors
.
push
(
"Remote file `
#{
location
}
` could not be fetched because of a timeout error!"
)
errors
.
push
(
"Remote file `
#{
location
}
` could not be fetched because of a timeout error!"
)
rescue
Gitlab
::
HTTP
::
Error
rescue
Gitlab
::
HTTP
::
Error
errors
.
push
(
"Remote file `
#{
location
}
` could not be fetched because of HTTP error!"
)
errors
.
push
(
"Remote file `
#{
location
}
` could not be fetched because of HTTP error!"
)
rescue
Gitlab
::
HTTP
::
BlockedUrlError
rescue
Gitlab
::
HTTP
::
BlockedUrlError
=>
e
errors
.
push
(
"Remote file
`
#{
location
}
` could not be fetched because the URL is blocked
!"
)
errors
.
push
(
"Remote file
could not be fetched because
#{
e
}
!"
)
end
end
if
response
&
.
code
.
to_i
>=
400
if
response
&
.
code
.
to_i
>=
400
errors
.
push
<<~
ERROR
errors
.
push
(
"Remote file `
#{
location
}
` could not be fetched because of HTTP code `
#{
response
.
code
}
` error!"
)
Remote file `
#{
location
}
` could not be fetched because of HTTP code `
#{
response
.
code
}
` error!
ERROR
end
end
response
.
to_s
if
errors
.
none?
response
.
to_s
if
errors
.
none?
...
...
spec/lib/gitlab/ci/config/external/file/remote_spec.rb
View file @
e26a30e5
...
@@ -144,5 +144,14 @@ describe Gitlab::Ci::Config::External::File::Remote do
...
@@ -144,5 +144,14 @@ describe Gitlab::Ci::Config::External::File::Remote do
expect
(
subject
).
to
match
/could not be fetched because of HTTP code `404` error!/
expect
(
subject
).
to
match
/could not be fetched because of HTTP code `404` error!/
end
end
end
end
context
'when the URL is blocked'
do
let
(
:location
)
{
'http://127.0.0.1/some/path/to/config.yaml'
}
it
'should include details about blocked URL'
do
expect
(
subject
).
to
eq
"Remote file could not be fetched because URL '
#{
location
}
' "
\
'is blocked: Requests to localhost are not allowed!'
end
end
end
end
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