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
7441472e
Commit
7441472e
authored
Sep 30, 2019
by
Adrien Kohlbecker
Committed by
Robert Speicher
Sep 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable gitlab-workhorse static error page on health endpoints
parent
58182ede
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
app/controllers/health_controller.rb
app/controllers/health_controller.rb
+4
-0
changelogs/unreleased/ak-health-check-custom-error.yml
changelogs/unreleased/ak-health-check-custom-error.yml
+5
-0
spec/controllers/health_controller_spec.rb
spec/controllers/health_controller_spec.rb
+13
-0
No files found.
app/controllers/health_controller.rb
View file @
7441472e
...
@@ -41,6 +41,10 @@ class HealthController < ActionController::Base
...
@@ -41,6 +41,10 @@ class HealthController < ActionController::Base
info
[
:labels
]
=
r
.
labels
if
r
.
labels
info
[
:labels
]
=
r
.
labels
if
r
.
labels
[
name
,
info
]
[
name
,
info
]
end
end
# disable static error pages at the gitlab-workhorse level, we want to see this error response even in production
headers
[
"X-GitLab-Custom-Error"
]
=
1
unless
success
render
json:
response
.
to_h
,
status:
success
?
:ok
:
:service_unavailable
render
json:
response
.
to_h
,
status:
success
?
:ok
:
:service_unavailable
end
end
end
end
changelogs/unreleased/ak-health-check-custom-error.yml
0 → 100644
View file @
7441472e
---
title
:
Disable gitlab-workhorse static error page on health endpoints
merge_request
:
17770
author
:
type
:
fixed
spec/controllers/health_controller_spec.rb
View file @
7441472e
...
@@ -30,6 +30,19 @@ describe HealthController do
...
@@ -30,6 +30,19 @@ describe HealthController do
expect
(
json_response
[
'shared_state_check'
][
'status'
]).
to
eq
(
'ok'
)
expect
(
json_response
[
'shared_state_check'
][
'status'
]).
to
eq
(
'ok'
)
expect
(
json_response
[
'gitaly_check'
][
'status'
]).
to
eq
(
'ok'
)
expect
(
json_response
[
'gitaly_check'
][
'status'
]).
to
eq
(
'ok'
)
end
end
it
'responds with readiness checks data when a failure happens'
do
allow
(
Gitlab
::
HealthChecks
::
Redis
::
RedisCheck
).
to
receive
(
:readiness
).
and_return
(
Gitlab
::
HealthChecks
::
Result
.
new
(
false
,
"check error"
))
subject
expect
(
json_response
[
'redis_check'
][
'status'
]).
to
eq
(
'failed'
)
expect
(
json_response
[
'redis_check'
][
'message'
]).
to
eq
(
'check error'
)
expect
(
json_response
[
'cache_check'
][
'status'
]).
to
eq
(
'ok'
)
expect
(
response
.
status
).
to
eq
(
503
)
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
eq
(
1
)
end
end
end
context
'accessed from whitelisted ip'
do
context
'accessed from whitelisted ip'
do
...
...
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