Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
fd41b8a4
Commit
fd41b8a4
authored
Jun 20, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify protocol assign, and populate ENV['PROTOCOL'] variable when calling hooks via SSH
parent
1c18095c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
hooks/pre-receive
hooks/pre-receive
+1
-3
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+2
-1
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+1
-1
No files found.
hooks/pre-receive
View file @
fd41b8a4
...
...
@@ -5,14 +5,12 @@
refs
=
$stdin
.
read
key_id
=
ENV
[
'GL_ID'
]
protocol
=
ENV
[
'PROTOCOL'
]
protocol
=
ENV
[
'PROTOCOL'
]
||
'http'
repo_path
=
Dir
.
pwd
require_relative
'../lib/gitlab_custom_hook'
require_relative
'../lib/gitlab_access'
protocol
||=
'http'
if
GitlabAccess
.
new
(
repo_path
,
key_id
,
refs
,
protocol
).
exec
&&
GitlabCustomHook
.
new
.
pre_receive
(
refs
,
repo_path
)
exit
0
...
...
lib/gitlab_shell.rb
View file @
fd41b8a4
...
...
@@ -131,7 +131,8 @@ class GitlabShell
'PATH'
=>
ENV
[
'PATH'
],
'LD_LIBRARY_PATH'
=>
ENV
[
'LD_LIBRARY_PATH'
],
'LANG'
=>
ENV
[
'LANG'
],
'GL_ID'
=>
@key_id
'GL_ID'
=>
@key_id
,
'PROTOCOL'
=>
'ssh'
}
if
@config
.
git_annex_enabled?
...
...
spec/gitlab_shell_spec.rb
View file @
fd41b8a4
...
...
@@ -242,7 +242,7 @@ describe GitlabShell do
after
{
subject
.
exec
(
ssh_cmd
)
}
it
"should call api.check_access"
do
api
.
should_receive
(
:check_access
).
with
(
'git-upload-pack'
,
'gitlab-ci.git'
,
key_id
,
'_any'
)
api
.
should_receive
(
:check_access
).
with
(
'git-upload-pack'
,
'gitlab-ci.git'
,
key_id
,
'_any'
,
'ssh'
)
end
it
"should disallow access and log the attempt if check_access returns false status"
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