BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
aa51106b
Commit
aa51106b
authored
Dec 25, 2017
by
Grzegorz Bizon
Committed by
Tiago
Dec 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'sh-handle-orphaned-deploy-keys' into 'master'
Gracefully handle orphaned write deploy keys in /internal/post_receive Closes #41466 See merge request gitlab-org/gitlab-ce!16127 (cherry picked from commit
228f42b5
)
36bdf3dc
Gracefully handle orphaned write deploy keys in /internal/post_receive
parent
6a8df993
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
sh-handle-orphaned-deploy-keys.yml
changelogs/unreleased/sh-handle-orphaned-deploy-keys.yml
+5
-0
internal.rb
lib/api/internal.rb
+6
-3
internal_spec.rb
spec/requests/api/internal_spec.rb
+10
-0
No files found.
changelogs/unreleased/sh-handle-orphaned-deploy-keys.yml
0 → 100644
View file @
aa51106b
---
title
:
Gracefully handle orphaned write deploy keys in /internal/post_receive
merge_request
:
author
:
type
:
fixed
lib/api/internal.rb
View file @
aa51106b
...
...
@@ -190,9 +190,12 @@ module API
project
=
Gitlab
::
GlRepository
.
parse
(
params
[
:gl_repository
]).
first
user
=
identify
(
params
[
:identifier
])
redirect_message
=
Gitlab
::
Checks
::
ProjectMoved
.
fetch_redirect_message
(
user
.
id
,
project
.
id
)
if
redirect_message
output
[
:redirected_message
]
=
redirect_message
# A user is not guaranteed to be returned; an orphaned write deploy
# key could be used
if
user
redirect_message
=
Gitlab
::
Checks
::
ProjectMoved
.
fetch_redirect_message
(
user
.
id
,
project
.
id
)
output
[
:redirected_message
]
=
redirect_message
if
redirect_message
end
output
...
...
spec/requests/api/internal_spec.rb
View file @
aa51106b
...
...
@@ -784,6 +784,16 @@ describe API::Internal do
expect
(
json_response
[
"redirected_message"
]).
to
eq
(
project_moved
.
redirect_message
)
end
end
context
'with an orphaned write deploy key'
do
it
'does not try to notify that project moved'
do
allow_any_instance_of
(
Gitlab
::
Identifier
).
to
receive
(
:identify
).
and_return
(
nil
)
post
api
(
"/internal/post_receive"
),
valid_params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
end
describe
'POST /internal/pre_receive'
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