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
6b7a9b74
Commit
6b7a9b74
authored
Mar 28, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow console messages be sent to gitlab-shell
Currently a no-op for CE
parent
74ace2a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
lib/api/internal.rb
lib/api/internal.rb
+2
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+5
-1
lib/gitlab/git_access_result/success.rb
lib/gitlab/git_access_result/success.rb
+5
-0
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+34
-0
No files found.
lib/api/internal.rb
View file @
6b7a9b74
...
...
@@ -87,7 +87,8 @@ module API
gl_id:
Gitlab
::
GlId
.
gl_id
(
user
),
gl_username:
user
&
.
username
,
git_config_options:
[],
gitaly:
gitaly_payload
(
params
[
:action
])
gitaly:
gitaly_payload
(
params
[
:action
]),
gl_console_messages:
check_result
.
console_messages
}
# Custom option for git-receive-pack command
...
...
lib/gitlab/git_access.rb
View file @
6b7a9b74
...
...
@@ -85,7 +85,7 @@ module Gitlab
check_push_access!
end
::
Gitlab
::
GitAccessResult
::
Success
.
new
::
Gitlab
::
GitAccessResult
::
Success
.
new
(
console_messages:
check_for_console_messages
(
cmd
))
end
def
guest_can_download_code?
...
...
@@ -116,6 +116,10 @@ module Gitlab
nil
end
def
check_for_console_messages
(
cmd
)
[]
end
def
check_valid_actor!
return
unless
actor
.
is_a?
(
Key
)
...
...
lib/gitlab/git_access_result/success.rb
View file @
6b7a9b74
...
...
@@ -3,6 +3,11 @@
module
Gitlab
module
GitAccessResult
class
Success
attr_reader
:console_messages
def
initialize
(
console_messages:
[])
@console_messages
=
console_messages
end
end
end
end
spec/requests/api/internal_spec.rb
View file @
6b7a9b74
...
...
@@ -498,6 +498,40 @@ describe API::Internal do
end
end
context
"console message"
do
before
do
project
.
add_developer
(
user
)
end
context
"git pull"
do
context
"with no console message"
do
it
"has the correct payload"
do
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
([])
end
end
context
"with a console message"
do
let
(
:console_messages
)
{
[
'message for the console'
]
}
it
"has the correct payload"
do
expect_next_instance_of
(
Gitlab
::
GitAccess
)
do
|
access
|
expect
(
access
).
to
receive
(
:check_for_console_messages
)
.
with
(
'git-upload-pack'
)
.
and_return
(
console_messages
)
end
pull
(
key
,
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'gl_console_messages'
]).
to
eq
(
console_messages
)
end
end
end
end
context
"blocked user"
do
let
(
:personal_project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
...
...
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