Commit d64090b8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

No gitolite in project any more

parent 8e0b58d7
v 5.0.0
- replaced gitolite with gitlab-shell
- Replaced gitolite with gitlab-shell
v 4.2.0
- Teams
- User show page. Via /u/username
- Show help contents on pages for better navigation
......
......@@ -41,9 +41,7 @@ class Admin::ProjectsController < Admin::ApplicationController
end
def destroy
# Delete team first in order to prevent multiple gitolite calls
@project.team.truncate
@project.destroy
redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
......
class ErrorsController < ApplicationController
def githost
render "errors/gitolite"
end
end
......@@ -93,9 +93,7 @@ class ProjectsController < ProjectResourceController
def destroy
return access_denied! unless can?(current_user, :remove_project, project)
# Delete team first in order to prevent multiple gitolite calls
project.team.truncate
project.destroy
respond_to do |format|
......
......@@ -31,8 +31,6 @@ class Namespace < ActiveRecord::Base
scope :root, where('type IS NULL')
attr_accessor :require_update_gitolite
def self.search query
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end
......@@ -60,13 +58,13 @@ class Namespace < ActiveRecord::Base
end
def namespace_full_path
@namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
@namespace_full_path ||= File.join(Gitlab.config.gitlab_shell.repos_path, path)
end
def move_dir
if path_changed?
old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
new_path = File.join(Gitlab.config.gitolite.repos_path, path)
old_path = File.join(Gitlab.config.gitlab_shell.repos_path, path_was)
new_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
if File.exists?(new_path)
raise "Already exists"
end
......@@ -81,7 +79,6 @@ class Namespace < ActiveRecord::Base
FileUtils.mv( old_path, new_path )
send_update_instructions
@require_update_gitolite = true
rescue Exception => e
raise "Namespace move error #{old_path} #{new_path}"
end
......@@ -89,7 +86,7 @@ class Namespace < ActiveRecord::Base
end
def rm_dir
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
FileUtils.rm_r( dir_path, force: true )
end
......
......@@ -140,10 +140,6 @@ class Project < ActiveRecord::Base
nil
end
def git_error?
error_code == :gitolite
end
def saved?
id && valid?
end
......@@ -157,7 +153,7 @@ class Project < ActiveRecord::Base
end
def repo_name
denied_paths = %w(gitolite-admin admin dashboard groups help profile projects search)
denied_paths = %w(admin dashboard groups help profile projects search)
if denied_paths.include?(path)
errors.add(:path, "like #{path} is not allowed")
......@@ -450,7 +446,7 @@ class Project < ActiveRecord::Base
end
def url_to_repo
gitolite.url_to_repo(path_with_namespace)
gitlab_shell.url_to_repo(path_with_namespace)
end
def namespace_dir
......
......@@ -25,7 +25,7 @@ class Repository
end
def path_to_repo
@path_to_repo ||= File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
@path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, "#{path_with_namespace}.git")
end
def repo
......
......@@ -22,7 +22,7 @@
%b
Path:
%td
%span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path)
%span.monospace= File.join(Gitlab.config.gitlab_shell.repos_path, @group.path)
%tr
%td
%b
......
%h1.http_status_code 500
%h3.page_title GitLab was unable to access your Gitolite system.
%hr
.git_error_tips
%h4 Tips for Administrator:
%ol
%li
%p
Check git logs in admin area
%li
%p
Check config/gitlab.yml for correct settings.
%li
%p
Diagnostic tool:
%pre
bundle exec rake gitlab:check RAILS_ENV=production
%li
%p
Permissions:
%pre
= preserve do
sudo chown -R git:git #{Gitlab.config.gitolite.repos_path}
sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path}
......@@ -2,9 +2,9 @@ class GitoliteWorker
include Sidekiq::Worker
include Gitolited
sidekiq_options queue: :gitolite
sidekiq_options queue: :gitlab_shell
def perform(action, *arg)
gitolite.send(action, *arg)
gitlab_shell.send(action, *arg)
end
end
......@@ -5,10 +5,10 @@ class PostReceive
def perform(repo_path, oldrev, newrev, ref, identifier)
if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else
Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitolite.repos_path variable. \"#{Gitlab.config.gitolite.repos_path}\" does not match \"#{repo_path}\"")
Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"")
end
repo_path.gsub!(/.git$/, "")
......@@ -22,7 +22,8 @@ class PostReceive
end
# Ignore push from non-gitlab users
user = if identifier.eql? Gitlab.config.gitolite.admin_key
user = if identifier.nil?
raise identifier.inspect
email = project.repository.commit(newrev).author.email rescue nil
User.find_by_email(email) if email
elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
......
......@@ -5,8 +5,7 @@
# How to use:
# 1. copy file as gitlab.yml
# 2. Replace gitlab -> host with your domain
# 3. Replace gitolite -> ssh_host with your domain
# 4. Replace gitlab -> email_from
# 3. Replace gitlab -> email_from
#
# 1. GitLab app settings
......@@ -22,8 +21,8 @@ gitlab:
# Note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed
# relative_url_root: /gitlab
# Uncomment and customize if you can't use the default user to run GitLab (default: 'gitlab')
# user: user123
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
# user: git
## Email settings
# Email address used in the "From" field in mails sent by GitLab
......@@ -103,21 +102,18 @@ backup:
path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
# keep_time: 604800 # default: 0 (forever) (in seconds)
## Gitolite settings
gitolite:
## GitLab Shell settings
gitlab_shell:
# REPOS_PATH MUST NOT BE A SYMLINK!!!
repos_path: /home/git/repositories/
hooks_path: /home/git/gitlab-shell/hooks/
admin_key: gitlab
# Git over HTTP
upload_pack: true
receive_pack: true
ssh_user: git
ssh_host: localhost
# ssh_port: 22
# config_file: gitolite.conf
# Uncomment and customize if you can't use the default group to own the repositories and run Gitolite (default: same as the 'ssh_user' above)
# owner_group: group123
# If you use non-standart ssh port you need to specify it
# ssh_port: 22
## Git settings
# CAUTION!
......
......@@ -8,11 +8,11 @@ class Settings < Settingslogic
private
def build_gitolite_ssh_path_prefix
if gitolite.ssh_port != 22
"ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/"
def build_gitlab_shell_ssh_path_prefix
if gitlab_shell.ssh_port != 22
"ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/"
else
"#{gitolite.ssh_user}@#{gitolite.ssh_host}:"
"#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:"
end
end
......@@ -41,6 +41,9 @@ Settings['omniauth'] ||= Settingslogic.new({})
Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
Settings.omniauth['providers'] ||= []
#
# GitLab
#
Settings['gitlab'] ||= Settingslogic.new({})
Settings.gitlab['default_projects_limit'] ||= 10
Settings.gitlab['host'] ||= 'localhost'
......@@ -54,29 +57,38 @@ Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['signup_enabled'] ||= false
#
# Gravatar
#
Settings['gravatar'] ||= Settingslogic.new({})
Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
Settings['gitolite'] ||= Settingslogic.new({})
Settings.gitolite['admin_key'] ||= 'gitlab'
Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin'
Settings.gitolite['config_file'] ||= 'gitolite.conf'
Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/'
Settings.gitolite['receive_pack'] = true if Settings.gitolite['receive_pack'].nil?
Settings.gitolite['upload_pack'] = true if Settings.gitolite['upload_pack'].nil?
Settings.gitolite['repos_path'] ||= '/home/git/repositories/'
Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
Settings.gitolite['ssh_port'] ||= 22
Settings.gitolite['ssh_user'] ||= 'git'
Settings.gitolite['owner_group'] ||= Settings.gitolite.ssh_user
Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix)
#
# GitLab Shell
#
Settings['gitlab_shell'] ||= Settingslogic.new({})
Settings.gitlab_shell['hooks_path'] ||= '/home/git/gitlab-shell/hooks/'
Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil?
Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil?
Settings.gitlab_shell['repos_path'] ||= '/home/git/repositories/'
Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
Settings.gitlab_shell['ssh_port'] ||= 22
Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user
Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user
Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_ssh_path_prefix)
#
# Backup
#
Settings['backup'] ||= Settingslogic.new({})
Settings.backup['keep_time'] ||= 0
Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root)
#
# Git
#
Settings['git'] ||= Settingslogic.new({})
Settings.git['max_size'] ||= 5242880 # 5.megabytes
Settings.git['bin_path'] ||= '/usr/bin/git'
......
......@@ -18,9 +18,9 @@ Gitlab::Application.routes.draw do
# Enable Grack support
mount Grack::Bundle.new({
git_path: Gitlab.config.git.bin_path,
project_root: Gitlab.config.gitolite.repos_path,
upload_pack: Gitlab.config.gitolite.upload_pack,
receive_pack: Gitlab.config.gitolite.receive_pack
project_root: Gitlab.config.gitlab_shell.repos_path,
upload_pack: Gitlab.config.gitlab_shell.upload_pack,
receive_pack: Gitlab.config.gitlab_shell.receive_pack
}), at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }
#
......
......@@ -31,9 +31,9 @@ DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario do
# Use tmp dir for FS manipulations
Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
FileUtils.rm_rf Gitlab.config.gitolite.repos_path
FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
Gitlab.config.gitlab_shell.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path
FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path
end
Spinach.hooks.after_scenario do
......
......@@ -44,7 +44,7 @@ module Gitlab
def url_to_repo path
Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
Gitlab.config.gitlab_shell.ssh_path_prefix + "#{path}.git"
end
end
end
......@@ -15,10 +15,10 @@ module Gitlab
def execute
# Create new dir if missing
new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
new_dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, new_dir)
FileUtils.mkdir( new_dir_path, mode: 0770 ) unless File.exists?(new_dir_path)
old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
old_path = File.join(Gitlab.config.gitlab_shell.repos_path, old_dir, "#{project.path}.git")
new_path = File.join(new_dir_path, "#{project.path}.git")
if File.exists? new_path
......
# == Gitolited mixin
#
# Provide a shortcut to Gitlab::Gitolite instance by gitolite
# Provide a shortcut to Gitlab::Shell instance by gitlab_shell
#
# Used by Project, UsersProject, etc
#
module Gitolited
def gitolite
def gitlab_shell
Gitlab::Shell.new
end
end
......@@ -144,7 +144,7 @@ namespace :gitlab do
task :restore => :environment do
backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
repos_path = Gitlab.config.gitolite.repos_path
repos_path = Gitlab.config.gitlab_shell.repos_path
puts "Restoring repositories ... "
......
namespace :gitlab do
desc "GITLAB | Check the configuration of GitLab and its environment"
task check: %w{gitlab:env:check
gitlab:gitolite:check
gitlab:gitlab_shell:check
gitlab:sidekiq:check
gitlab:app:check}
......@@ -296,10 +296,10 @@ namespace :gitlab do
# see https://github.com/gitlabhq/gitlabhq/issues/1059
def check_issue_1059_shell_profile_error
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
print "Has no \"-e\" in ~#{gitlab_shell_ssh_user}/.profile ... "
profile_file = File.join(gitolite_user_home, ".profile")
profile_file = File.join(gitlab_shell_user_home, ".profile")
unless File.read(profile_file) =~ /^-e PATH/
puts "yes".green
......@@ -367,7 +367,7 @@ namespace :gitlab do
namespace :gitolite do
namespace :gitlab_shell do
desc "GITLAB | Check the configuration of Gitolite"
task check: :environment do
warn_user_is_not_gitlab
......@@ -392,25 +392,25 @@ namespace :gitlab do
print "post-receive hook up-to-date? ... "
hook_file = "post-receive"
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
unless File.exists?(gitolite_hook_file)
unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
gitolite_hook_content = File.read(gitolite_hook_file)
gitlab_shell_hook_content = File.read(gitlab_shell_hook_file)
gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
gitlab_hook_content = File.read(gitlab_hook_file)
if gitolite_hook_content == gitlab_hook_content
if gitlab_shell_hook_content == gitlab_hook_content
puts "yes".green
else
puts "no".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} cp #{gitlab_hook_file} #{gitlab_shell_hook_file}"
)
for_more_information(
see_installation_guide_section "Setup GitLab Hooks"
......@@ -422,7 +422,7 @@ namespace :gitlab do
def check_repo_base_exists
print "Repo base directory exists? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
if File.exists?(repo_base_path)
puts "yes".green
......@@ -444,7 +444,7 @@ namespace :gitlab do
def check_repo_base_is_not_symlink
print "Repo base directory is a symlink? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
......@@ -464,7 +464,7 @@ namespace :gitlab do
def check_repo_base_permissions
print "Repo base access is drwxrws---? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
......@@ -487,23 +487,23 @@ namespace :gitlab do
end
def check_repo_base_user_and_group
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitolite_owner_group = Gitlab.config.gitolite.owner_group
print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_owner_group}? ... "
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group
print "Repo base owned by #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group}? ... "
repo_base_path = Gitlab.config.gitolite.repos_path
repo_base_path = Gitlab.config.gitlab_shell.repos_path
unless File.exists?(repo_base_path)
puts "can't check because of previous errors".magenta
return
end
if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) &&
File.stat(repo_base_path).gid == gid_for(gitolite_owner_group)
if File.stat(repo_base_path).uid == uid_for(gitlab_shell_ssh_user) &&
File.stat(repo_base_path).gid == gid_for(gitlab_shell_owner_group)
puts "yes".green
else
puts "no".red
try_fixing_it(
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{repo_base_path}"
"sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
)
for_more_information(
see_installation_guide_section "Gitolite"
......@@ -516,11 +516,11 @@ namespace :gitlab do
print "post-receive hooks in repos are links: ... "
hook_file = "post-receive"
gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
unless File.exists?(gitolite_hook_file)
unless File.exists?(gitlab_shell_hook_file)
puts "can't check because of previous errors".magenta
return
end
......@@ -542,7 +542,7 @@ namespace :gitlab do
unless File.exists?(project_hook_file)
puts "missing".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
......@@ -552,12 +552,12 @@ namespace :gitlab do
end
if File.lstat(project_hook_file).symlink? &&
File.realpath(project_hook_file) == File.realpath(gitolite_hook_file)
File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file)
puts "ok".green
else
puts "not a link to Gitolite's hook".red
try_fixing_it(
"sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
"lib/support/rewrite-hooks.sh"
......@@ -572,19 +572,19 @@ namespace :gitlab do
# Helper methods
########################
def gitolite_user_home
File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
def gitlab_shell_user_home
File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
end
def gitolite_version
gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION"
if File.readable?(gitolite_version_file)
File.read(gitolite_version_file)
def gitlab_shell_version
gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab_shell/src/VERSION"
if File.readable?(gitlab_shell_version_file)
File.read(gitlab_shell_version_file)
end
end
def has_gitolite3?
gitolite_version.try(:start_with?, "v3.")
def has_gitlab_shell3?
gitlab_shell_version.try(:start_with?, "v3.")
end
end
......
......@@ -7,7 +7,7 @@ namespace :gitlab do
namespaces = Namespace.pluck(:path)
git_base_path = Gitlab.config.gitolite.repos_path
git_base_path = Gitlab.config.gitlab_shell.repos_path
all_dirs = Dir.glob(git_base_path + '/*')
puts git_base_path.yellow
......@@ -48,7 +48,7 @@ namespace :gitlab do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
git_base_path = Gitlab.config.gitolite.repos_path
git_base_path = Gitlab.config.gitlab_shell.repos_path
all_dirs = Dir.glob(git_base_path + '/*')
global_projects = Project.where(namespace_id: nil).pluck(:path)
......@@ -68,13 +68,6 @@ namespace :gitlab do
global_projects.include?(path)
end
# skip gitolite admin
all_dirs.reject! do |dir|
repo_name = File.basename dir
repo_name == 'gitolite-admin.git'
end
all_dirs.each do |dir_path|
if remove_flag
if FileUtils.rm_rf dir_path
......
......@@ -6,11 +6,6 @@ namespace :gitlab do
migrate_user_namespaces
migrate_groups
migrate_projects
puts "Rebuild Gitolite ... "
gitolite = Gitlab::Gitolite.new
gitolite.update_repositories(Project.where('namespace_id IS NOT NULL'))
puts "... #{"done".green}"
end
def migrate_user_namespaces
......@@ -80,7 +75,7 @@ namespace :gitlab do
end
def migrate_projects
git_path = Gitlab.config.gitolite.repos_path
git_path = Gitlab.config.gitlab_shell.repos_path
puts "\nMove projects in groups into respective directories ... ".blue
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
next unless project.group
......
......@@ -12,7 +12,7 @@ namespace :gitlab do
desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
task :repos => :environment do
git_base_path = Gitlab.config.gitolite.repos_path
git_base_path = Gitlab.config.gitlab_shell.repos_path
repos_to_import = Dir.glob(git_base_path + '/*')
namespaces = Namespace.pluck(:path)
......@@ -26,7 +26,6 @@ namespace :gitlab do
# skip if not git repo
next unless repo_name =~ /.git$/
# skip gitolite admin
next if repo_name == 'gitolite-admin.git'
path = repo_name.sub(/\.git$/, '')
......
......@@ -54,16 +54,16 @@ namespace :gitlab do
# check Gitolite version
gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitlab-shell/VERSION"
if File.readable?(gitolite_version_file)
gitolite_version = File.read(gitolite_version_file)
gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.repos_path}/../gitlab-shell/VERSION"
if File.readable?(gitlab_shell_version_file)
gitlab_shell_version = File.read(gitlab_shell_version_file)
end
puts ""
puts "GitLab Shell".yellow
puts "Version:\t#{gitolite_version || "unknown".red}"
puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}"
puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}"
puts "Version:\t#{gitlab_shell_version || "unknown".red}"
puts "Repositories:\t#{Gitlab.config.gitlab_shell.repos_path}"
puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}"
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
end
......
......@@ -8,7 +8,7 @@ namespace :gitlab do
desc "GITLAB | Build missing projects"
task build_missing_projects: :environment do
Project.find_each(batch_size: 1000) do |project|
path_to_repo = File.join(Gitlab.config.gitolite.repos_path, "#{project.path_with_namespace}.git")
path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
if File.exists?(path_to_repo)
print '-'
else
......
......@@ -6,7 +6,7 @@ namespace :sidekiq do
desc "GITLAB | Start sidekiq"
task :start do
run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitolite,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
end
def pidfile
......
......@@ -35,7 +35,7 @@ RSpec.configure do |config|
config.before do
# Use tmp dir for FS manipulations
temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
Gitlab.config.gitlab_shell.stub(repos_path: temp_repos_path)
FileUtils.rm_rf temp_repos_path
FileUtils.mkdir_p temp_repos_path
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment