Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/gitlab')
-rw-r--r--lib/tasks/gitlab/check.rake17
-rw-r--r--lib/tasks/gitlab/setup.rake8
-rw-r--r--lib/tasks/gitlab/shell.rake12
-rw-r--r--lib/tasks/gitlab/task_helpers.rake2
-rw-r--r--lib/tasks/gitlab/test.rake4
5 files changed, 35 insertions, 8 deletions
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 767674e1e84..071760c0c36 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -17,6 +17,7 @@ namespace :gitlab do
check_database_config_exists
check_database_is_not_sqlite
check_migrations_are_up
+ check_orphaned_users_groups
check_gitlab_config_exists
check_gitlab_config_not_outdated
check_log_writable
@@ -65,6 +66,7 @@ namespace :gitlab do
puts "no".green
else
puts "yes".red
+ puts "Please fix this by removing the SQLite entry from the database.yml".blue
for_more_information(
"https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL",
see_database_guide
@@ -181,6 +183,19 @@ namespace :gitlab do
end
end
+ def check_orphaned_users_groups
+ print "Database contains orphaned UsersGroups? ... "
+ if UsersGroup.where("user_id not in (select id from users)").count > 0
+ puts "yes".red
+ try_fixing_it(
+ "You can delete the orphaned records using something along the lines of:",
+ sudo_gitlab("bundle exec rails runner -e production 'UsersGroup.where(\"user_id NOT IN (SELECT id FROM users)\").delete_all'")
+ )
+ else
+ puts "no".green
+ end
+ end
+
def check_satellites_exist
print "Projects have satellites? ... "
@@ -727,7 +742,7 @@ namespace :gitlab do
end
def check_gitlab_shell
- required_version = Gitlab::VersionInfo.new(1, 7, 9)
+ required_version = Gitlab::VersionInfo.new(1, 9, 1)
current_version = Gitlab::VersionInfo.parse(gitlab_shell_version)
print "GitLab Shell version >= #{required_version} ? ... "
diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake
index 2b730774e06..853994dd67d 100644
--- a/lib/tasks/gitlab/setup.rake
+++ b/lib/tasks/gitlab/setup.rake
@@ -15,6 +15,14 @@ namespace :gitlab do
end
Rake::Task["db:setup"].invoke
+
+ config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
+ success = case config["adapter"]
+ when /^mysql/ then
+ Rake::Task["add_limits_mysql"].invoke
+ when "postgresql" then
+ end
+
Rake::Task["db:seed_fu"].invoke
rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".red
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index 0d7a390bc92..08de0f2dd5d 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -34,14 +34,18 @@ namespace :gitlab do
Gitlab::Shell.new.remove_all_keys
- Key.find_each(batch_size: 1000) do |key|
- if Gitlab::Shell.new.add_key(key.shell_id, key.key)
+ Gitlab::Shell.new.batch_add_keys do |adder|
+ Key.find_each(batch_size: 1000) do |key|
+ adder.add_key(key.shell_id, key.key)
print '.'
- else
- print 'F'
end
end
+ unless $?.success?
+ puts "Failed to add keys...".red
+ exit 1
+ end
+
rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".red
exit 1
diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake
index d36b9682850..da61c6e007f 100644
--- a/lib/tasks/gitlab/task_helpers.rake
+++ b/lib/tasks/gitlab/task_helpers.rake
@@ -82,6 +82,8 @@ namespace :gitlab do
def run(command)
output, _ = Gitlab::Popen.popen(command)
output
+ rescue Errno::ENOENT
+ '' # if the command does not exist, return an empty string
end
def uid_for(user_name)
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
index f52af0c3ded..2c9b9978933 100644
--- a/lib/tasks/gitlab/test.rake
+++ b/lib/tasks/gitlab/test.rake
@@ -2,15 +2,13 @@ namespace :gitlab do
desc "GITLAB | Run all tests"
task :test do
cmds = [
- %W(rake db:setup),
- %W(rake db:seed_fu),
%W(rake spinach),
%W(rake spec),
%W(rake jasmine:ci)
]
cmds.each do |cmd|
- system({'RAILS_ENV' => 'test'}, *cmd)
+ system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd)
raise "#{cmd} failed!" unless $?.exitstatus.zero?
end