Extract EE specific files/lines for lib/tasks/gitlab
We have the following files containing EE specific code. We should move them to ee/
lib/tasks/gitlab/backup.rake
diff --git a/lib/tasks/gitlab/backup.rake b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/backup.rake
index 3a1a36e36ce..3977fc7ad8c 100644
--- a/lib/tasks/gitlab/backup.rake
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/backup.rake
@@ -61,7 +61,7 @@ namespace :gitlab do
Rake::Task['gitlab:backup:uploads:restore'].invoke unless backup.skipped?('uploads')
Rake::Task['gitlab:backup:builds:restore'].invoke unless backup.skipped?('builds')
Rake::Task['gitlab:backup:artifacts:restore'].invoke unless backup.skipped?('artifacts')
- Rake::Task["gitlab:backup:pages:restore"].invoke unless backup.skipped?('pages')
+ Rake::Task['gitlab:backup:pages:restore'].invoke unless backup.skipped?('pages')
Rake::Task['gitlab:backup:lfs:restore'].invoke unless backup.skipped?('lfs')
Rake::Task['gitlab:backup:registry:restore'].invoke unless backup.skipped?('registry')
Rake::Task['gitlab:shell:setup'].invoke
lib/tasks/gitlab/cleanup.rake
diff --git a/lib/tasks/gitlab/cleanup.rake b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/cleanup.rake
index 451ba651674..d1cb046d9e4 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/cleanup.rake
@@ -36,6 +36,36 @@ namespace :gitlab do
end
end
+ desc "GitLab | Cleanup | Delete moved repositories"
+ task moved: :gitlab_environment do
+ warn_user_is_not_gitlab
+ remove_flag = ENV['REMOVE']
+
+ Gitlab.config.repositories.storages.each do |name, repository_storage|
+ repo_root = repository_storage.legacy_disk_path.chomp('/')
+ # Look for global repos (legacy, depth 1) and normal repos (depth 2)
+ IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find|
+ find.each_line do |path|
+ path.chomp!
+
+ if remove_flag
+ if FileUtils.rm_rf(path)
+ puts "Removed...#{path}".color(:green)
+ else
+ puts "Cannot remove #{path}".color(:red)
+ end
+ else
+ puts "Can be removed: #{path}".color(:green)
+ end
+ end
+ end
+ end
+
+ unless remove_flag
+ puts "To cleanup these repositories run this command with REMOVE=true".color(:yellow)
+ end
+ end
+
desc "GitLab | Cleanup | Clean repositories"
task repos: :gitlab_environment do
move_suffix = "+orphaned+#{Time.now.to_i}"
lib/tasks/gitlab/info.rake
diff --git a/lib/tasks/gitlab/info.rake b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/info.rake
index e97d77d20e0..66b8abe3e62 100644
--- a/lib/tasks/gitlab/info.rake
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/tasks/gitlab/info.rake
@@ -14,6 +14,8 @@ namespace :gitlab do
rake_version = run_and_match(%w(rake --version), /[\d\.]+/).try(:to_s)
# check redis version
redis_version = run_and_match(%w(redis-cli --version), /redis-cli (\d+\.\d+\.\d+)/).to_a
+ # check for system defined proxies
+ proxies = Gitlab::Proxy.detect_proxy.map {|k, v| "#{k}: #{v}"}.join("\n\t\t")
# check Git version
git_version = run_and_match([Gitlab.config.git.bin_path, '--version'], /git version ([\d\.]+)/).to_a
# check Go version
@@ -22,6 +24,7 @@ namespace :gitlab do
puts ""
puts "System information".color(:yellow)
puts "System:\t\t#{os_name || "unknown".color(:red)}"
+ puts "Proxy:\t\t#{proxies.present? ? proxies.color(:green) : "no"}"
puts "Current User:\t#{run_command(%w(whoami))}"
puts "Using RVM:\t#{rvm_version.present? ? "yes".color(:green) : "no"}"
puts "RVM Version:\t#{rvm_version}" if rvm_version.present?
@@ -35,13 +38,21 @@ namespace :gitlab do
puts "Go Version:\t#{go_version[1] || "unknown".color(:red)}"
# check database adapter
- database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
+ database_adapter = Gitlab::Database.adapter_name
+ database_version = Gitlab::Database.version
project = Group.new(path: "some-group").projects.build(path: "some-project")
# construct clone URLs
http_clone_url = project.http_url_to_repo
ssh_clone_url = project.ssh_url_to_repo
+ geo_node_type =
+ if Gitlab::Geo.current_node
+ Gitlab::Geo.current_node.primary ? 'Primary' : 'Secondary'
+ else
+ 'Undefined'.color(:red)
+ end
+
omniauth_providers = Gitlab.config.omniauth.providers.map { |provider| provider['name'] }
puts ""
@@ -50,9 +61,13 @@ namespace :gitlab do
puts "Revision:\t#{Gitlab.revision}"
puts "Directory:\t#{Rails.root}"
puts "DB Adapter:\t#{database_adapter}"
+ puts "DB Version:\t#{database_version}"
puts "URL:\t\t#{Gitlab.config.gitlab.url}"
puts "HTTP Clone URL:\t#{http_clone_url}"
puts "SSH Clone URL:\t#{ssh_clone_url}"
+ puts "Elasticsearch:\t#{Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing? ? "yes".color(:green) : "no"}"
+ puts "Geo:\t\t#{Gitlab::Geo.enabled? ? "yes".color(:green) : "no"}"
+ puts "Geo node:\t#{geo_node_type}" if Gitlab::Geo.enabled?
puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".color(:green) : "no"}"
puts "Using Omniauth:\t#{Gitlab::Auth.omniauth_enabled? ? "yes".color(:green) : "no"}"
puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab::Auth.omniauth_enabled?
Edited by Yorick Peterse