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
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-shell
Commits
199e2d62
Commit
199e2d62
authored
Mar 06, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1648-remove-git-annex-support' into 'master'
Remove git annex support See merge request !122
parents
a6e5b9a1
416c7a89
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
10 additions
and
123 deletions
+10
-123
.gitignore
.gitignore
+1
-0
.gitlab-ci.yml
.gitlab-ci.yml
+2
-2
CHANGELOG
CHANGELOG
+3
-0
README.md
README.md
+1
-1
VERSION
VERSION
+1
-1
config.yml.example
config.yml.example
+0
-8
lib/gitlab_config.rb
lib/gitlab_config.rb
+0
-4
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+2
-41
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+0
-66
No files found.
.gitignore
View file @
199e2d62
config.yml
config.yml
tmp/*
tmp/*
.idea
*.log
*.log
/*.log*
/*.log*
authorized_keys.lock
authorized_keys.lock
...
...
.gitlab-ci.yml
View file @
199e2d62
...
@@ -2,8 +2,8 @@ image: "ruby:2.3"
...
@@ -2,8 +2,8 @@ image: "ruby:2.3"
before_script
:
before_script
:
-
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
-
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
-
apt
-get
update
-
apt update
-
apt
-get install -y git-annex
-
apt
install rsync -y
-
gem install --bindir /usr/local/bin bundler
-
gem install --bindir /usr/local/bin bundler
-
cp config.yml.example config.yml
-
cp config.yml.example config.yml
-
bundle install
-
bundle install
...
...
CHANGELOG
View file @
199e2d62
v5.0.0
- Remove support for git-annex
v4.1.1
v4.1.1
- Send (a selection of) git environment variables while making the API call to `/allowed`, !112
- Send (a selection of) git environment variables while making the API call to `/allowed`, !112
...
...
README.md
View file @
199e2d62
...
@@ -7,7 +7,7 @@ GitLab Shell is not a Unix shell nor a replacement for Bash or Zsh.
...
@@ -7,7 +7,7 @@ GitLab Shell is not a Unix shell nor a replacement for Bash or Zsh.
When you access the GitLab server over ssh then GitLab Shell will:
When you access the GitLab server over ssh then GitLab Shell will:
1.
Limits you to predefined git commands (git push, git pull
, git annex
).
1.
Limits you to predefined git commands (git push, git pull).
1.
Call the GitLab Rails API to check if you are authorized
1.
Call the GitLab Rails API to check if you are authorized
1.
It will execute the pre-receive hooks (called Git Hooks in GitLab Enterprise Edition)
1.
It will execute the pre-receive hooks (called Git Hooks in GitLab Enterprise Edition)
1.
It will execute the action you requested
1.
It will execute the action you requested
...
...
VERSION
View file @
199e2d62
4.1.1
5.0.0
config.yml.example
View file @
199e2d62
...
@@ -65,14 +65,6 @@ log_level: INFO
...
@@ -65,14 +65,6 @@ log_level: INFO
# incurs an extra API call on every gitlab-shell command.
# incurs an extra API call on every gitlab-shell command.
audit_usernames: false
audit_usernames: false
# Enable git-annex support
# git-annex allows managing files with git, without checking the file contents into git
# See https://git-annex.branchable.com/ for documentation
# If enabled, git-annex needs to be installed on the server where gitlab-shell is setup
# For Debian and Ubuntu systems this can be done with: sudo apt-get install git-annex
# For CentOS: sudo yum install epel-release && sudo yum install git-annex
git_annex_enabled: false
# Git trace log file.
# Git trace log file.
# If set, git commands receive GIT_TRACE* environment variables
# If set, git commands receive GIT_TRACE* environment variables
# See https://git-scm.com/book/es/v2/Git-Internals-Environment-Variables#Debugging for documentation
# See https://git-scm.com/book/es/v2/Git-Internals-Environment-Variables#Debugging for documentation
...
...
lib/gitlab_config.rb
View file @
199e2d62
...
@@ -54,10 +54,6 @@ class GitlabConfig
...
@@ -54,10 +54,6 @@ class GitlabConfig
@config
[
'audit_usernames'
]
||=
false
@config
[
'audit_usernames'
]
||=
false
end
end
def
git_annex_enabled?
@config
[
'git_annex_enabled'
]
||=
false
end
def
git_trace_log_file
def
git_trace_log_file
@config
[
'git_trace_log_file'
]
@config
[
'git_trace_log_file'
]
end
end
...
...
lib/gitlab_shell.rb
View file @
199e2d62
...
@@ -9,7 +9,7 @@ class GitlabShell
...
@@ -9,7 +9,7 @@ class GitlabShell
class
DisallowedCommandError
<
StandardError
;
end
class
DisallowedCommandError
<
StandardError
;
end
class
InvalidRepositoryPathError
<
StandardError
;
end
class
InvalidRepositoryPathError
<
StandardError
;
end
GIT_COMMANDS
=
%w(git-upload-pack git-receive-pack git-upload-archive git-
annex-shell git-
lfs-authenticate)
.
freeze
GIT_COMMANDS
=
%w(git-upload-pack git-receive-pack git-upload-archive git-lfs-authenticate)
.
freeze
API_COMMANDS
=
%w(2fa_recovery_codes)
API_COMMANDS
=
%w(2fa_recovery_codes)
GL_PROTOCOL
=
'ssh'
.
freeze
GL_PROTOCOL
=
'ssh'
.
freeze
...
@@ -71,10 +71,6 @@ class GitlabShell
...
@@ -71,10 +71,6 @@ class GitlabShell
raise
DisallowedCommandError
unless
GIT_COMMANDS
.
include?
(
@command
)
raise
DisallowedCommandError
unless
GIT_COMMANDS
.
include?
(
@command
)
case
@command
case
@command
when
'git-annex-shell'
raise
DisallowedCommandError
unless
@config
.
git_annex_enabled?
@repo_name
=
args
[
2
].
sub
(
/\A\/~\//
,
''
)
when
'git-lfs-authenticate'
when
'git-lfs-authenticate'
raise
DisallowedCommandError
unless
args
.
count
>=
2
raise
DisallowedCommandError
unless
args
.
count
>=
2
@repo_name
=
args
[
1
]
@repo_name
=
args
[
1
]
...
@@ -103,25 +99,7 @@ class GitlabShell
...
@@ -103,25 +99,7 @@ class GitlabShell
def
process_cmd
(
args
)
def
process_cmd
(
args
)
return
self
.
send
(
"api_
#{
@command
}
"
)
if
API_COMMANDS
.
include?
(
@command
)
return
self
.
send
(
"api_
#{
@command
}
"
)
if
API_COMMANDS
.
include?
(
@command
)
if
@command
==
'git-annex-shell'
if
@command
==
'git-lfs-authenticate'
raise
DisallowedCommandError
unless
@config
.
git_annex_enabled?
# Make sure repository has git-annex enabled
init_git_annex
unless
gcryptsetup?
(
args
)
parsed_args
=
args
.
map
do
|
arg
|
# use full repo path
if
arg
=~
/\A\/.*\.git\Z/
repo_path
else
arg
end
end
$logger
.
info
"gitlab-shell: executing git-annex command <
#{
parsed_args
.
join
(
' '
)
}
> for
#{
log_username
}
."
exec_cmd
(
*
parsed_args
)
elsif
@command
==
'git-lfs-authenticate'
GitlabMetrics
.
measure
(
'lfs-authenticate'
)
do
GitlabMetrics
.
measure
(
'lfs-authenticate'
)
do
$logger
.
info
"gitlab-shell: Processing LFS authentication for
#{
log_username
}
."
$logger
.
info
"gitlab-shell: Processing LFS authentication for
#{
log_username
}
."
lfs_authenticate
lfs_authenticate
...
@@ -150,10 +128,6 @@ class GitlabShell
...
@@ -150,10 +128,6 @@ class GitlabShell
'GL_PROTOCOL'
=>
GL_PROTOCOL
'GL_PROTOCOL'
=>
GL_PROTOCOL
}
}
if
@config
.
git_annex_enabled?
env
.
merge!
({
'GIT_ANNEX_SHELL_LIMITED'
=>
'1'
})
end
if
git_trace_available?
if
git_trace_available?
env
.
merge!
({
env
.
merge!
({
'GIT_TRACE'
=>
@config
.
git_trace_log_file
,
'GIT_TRACE'
=>
@config
.
git_trace_log_file
,
...
@@ -188,19 +162,6 @@ class GitlabShell
...
@@ -188,19 +162,6 @@ class GitlabShell
@config
.
audit_usernames
?
username
:
"user with key
#{
@key_id
}
"
@config
.
audit_usernames
?
username
:
"user with key
#{
@key_id
}
"
end
end
def
init_git_annex
unless
File
.
exists?
(
File
.
join
(
repo_path
,
'annex'
))
cmd
=
%W(git --git-dir=
#{
repo_path
}
annex init "GitLab")
system
(
*
cmd
,
err:
'/dev/null'
,
out:
'/dev/null'
)
$logger
.
info
"Enable git-annex for repository:
#{
repo_name
}
."
end
end
def
gcryptsetup?
(
args
)
non_dashed
=
args
.
reject
{
|
a
|
a
.
start_with?
(
'-'
)
}
non_dashed
[
0
,
2
]
==
%w{git-annex-shell gcryptsetup}
end
def
lfs_authenticate
def
lfs_authenticate
lfs_access
=
api
.
lfs_authenticate
(
@key_id
,
@repo_name
)
lfs_access
=
api
.
lfs_authenticate
(
@key_id
,
@repo_name
)
...
...
spec/gitlab_shell_spec.rb
View file @
199e2d62
...
@@ -99,20 +99,6 @@ describe GitlabShell do
...
@@ -99,20 +99,6 @@ describe GitlabShell do
end
end
end
end
describe
'git-annex'
do
let
(
:repo_name
)
{
'dzaporozhets/gitlab.git'
}
let
(
:ssh_args
)
{
%W(git-annex-shell inannex /~/dzaporozhets/gitlab.git SHA256E)
}
before
do
GitlabConfig
.
any_instance
.
stub
(
git_annex_enabled?:
true
)
subject
.
send
:parse_cmd
,
ssh_args
end
its
(
:repo_name
)
{
should
==
'dzaporozhets/gitlab.git'
}
its
(
:command
)
{
should
==
'git-annex-shell'
}
end
describe
'git-lfs'
do
describe
'git-lfs'
do
let
(
:repo_name
)
{
'dzaporozhets/gitlab.git'
}
let
(
:repo_name
)
{
'dzaporozhets/gitlab.git'
}
let
(
:ssh_args
)
{
%W(git-lfs-authenticate dzaporozhets/gitlab.git download)
}
let
(
:ssh_args
)
{
%W(git-lfs-authenticate dzaporozhets/gitlab.git download)
}
...
@@ -230,58 +216,6 @@ describe GitlabShell do
...
@@ -230,58 +216,6 @@ describe GitlabShell do
end
end
end
end
describe
'git-annex'
do
let
(
:repo_name
)
{
'dzaporozhets/gitlab.git'
}
before
do
GitlabConfig
.
any_instance
.
stub
(
git_annex_enabled?:
true
)
end
context
'initialization'
do
let
(
:ssh_cmd
)
{
"git-annex-shell inannex /~/gitlab-ci.git SHA256E"
}
before
do
# Create existing project
FileUtils
.
mkdir_p
(
repo_path
)
cmd
=
%W(git --git-dir=
#{
repo_path
}
init --bare)
system
(
*
cmd
)
subject
.
exec
(
ssh_cmd
)
end
it
'should init git-annex'
do
File
.
exists?
(
repo_path
).
should
be_true
end
context
'with git-annex-shell gcryptsetup'
do
let
(
:ssh_cmd
)
{
"git-annex-shell gcryptsetup /~/dzaporozhets/gitlab.git"
}
it
'should not init git-annex'
do
File
.
exists?
(
File
.
join
(
tmp_repos_path
,
'dzaporozhets/gitlab.git/annex'
)).
should
be_false
end
end
context
'with git-annex and relative path without ~/'
do
# Using a SSH URL on a custom port will generate /dzaporozhets/gitlab.git
let
(
:ssh_cmd
)
{
"git-annex-shell inannex dzaporozhets/gitlab.git SHA256E"
}
it
'should init git-annex'
do
File
.
exists?
(
File
.
join
(
tmp_repos_path
,
"dzaporozhets/gitlab.git/annex"
)).
should
be_true
end
end
end
context
'execution'
do
let
(
:ssh_cmd
)
{
"git-annex-shell commit /~/gitlab-ci.git SHA256"
}
after
{
subject
.
exec
(
ssh_cmd
)
}
it
"should execute the command"
do
subject
.
should_receive
(
:exec_cmd
).
with
(
"git-annex-shell"
,
"commit"
,
repo_path
,
"SHA256"
)
end
end
end
context
'with an API command'
do
context
'with an API command'
do
before
do
before
do
allow
(
subject
).
to
receive
(
:continue?
).
and_return
(
true
)
allow
(
subject
).
to
receive
(
:continue?
).
and_return
(
true
)
...
...
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