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
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
Kazuhiko Shiozaki
gitlab-ce
Commits
301c4068
Commit
301c4068
authored
Apr 05, 2014
by
Cyril Rohr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rake task to install or upgrade gitlab-shell installation.
parent
fead9678
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+58
-0
No files found.
lib/tasks/gitlab/shell.rake
View file @
301c4068
namespace
:gitlab
do
namespace
:shell
do
desc
"GITLAB | Install or upgrade gitlab-shell"
task
:install
,
[
:tag
,
:repo
]
=>
:environment
do
|
t
,
args
|
warn_user_is_not_gitlab
args
.
with_defaults
(
tag:
"v1.9.1"
,
repo:
"https://gitlab.com/gitlab-org/gitlab-shell.git"
)
user
=
Settings
.
gitlab
.
user
home_dir
=
Settings
.
gitlab
.
user_home
gitlab_url
=
Settings
.
gitlab
.
url
# gitlab-shell requires a / at the end of the url
gitlab_url
+=
"/"
unless
gitlab_url
.
match
(
/\/$/
)
target_dir
=
File
.
join
(
home_dir
,
"gitlab-shell"
)
# Clone if needed
unless
File
.
directory?
(
target_dir
)
sh
"git clone '
#{
args
.
repo
}
' '
#{
target_dir
}
'"
end
# Make sure we're on the right tag
Dir
.
chdir
(
target_dir
)
do
sh
"git fetch origin && git reset --hard $(git describe
#{
args
.
tag
}
|| git describe origin/
#{
args
.
tag
}
)"
redis_url
=
URI
.
parse
(
ENV
[
'REDIS_URL'
]
||
"redis://localhost:6379"
)
config
=
{
user:
user
,
gitlab_url:
gitlab_url
,
http_settings:
{
self_signed_cert:
false
},
repos_path:
File
.
join
(
home_dir
,
"repositories"
),
auth_file:
File
.
join
(
home_dir
,
".ssh"
,
"authorized_keys"
),
redis:
{
bin:
%x{which redis-cli}
.
chomp
,
host:
redis_url
.
host
,
port:
redis_url
.
port
,
namespace:
"resque:gitlab"
},
log_level:
"INFO"
,
audit_usernames:
false
}
# Generate config.yml based on existing gitlab settings
File
.
open
(
"config.yml"
,
"w+"
)
{
|
f
|
f
.
puts
config
.
to_yaml
}
# Launch installation process
sh
"bin/install"
end
# Required for debian packaging with PKGR: Setup .ssh/environment with
# the current PATH, so that the correct ruby version gets loaded
# Requires to set "PermitUserEnvironment yes" in sshd config (should not
# be an issue since it is more than likely that there are no "normal"
# user accounts on a gitlab server). The alternative is for the admin to
# install a ruby (1.9.3+) in the global path.
File
.
open
(
File
.
join
(
home_dir
,
".ssh"
,
"environment"
),
"w+"
)
do
|
f
|
f
.
puts
"PATH=
#{
ENV
[
'PATH'
]
}
"
end
end
desc
"GITLAB | Setup gitlab-shell"
task
setup: :environment
do
setup
...
...
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