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
path: root/lib/tasks
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-03 00:08:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-03 00:08:01 +0300
commit561e1b470f0a99fe6304c8f197348c47a637d594 (patch)
tree6b361b6b0b412b70450aca167079c50a13bd88d8 /lib/tasks
parent7b52c7cb634ef7047d30b0337fe477bcdcedf41d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/cleanup.rake33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
new file mode 100644
index 00000000000..8574f26dbdc
--- /dev/null
+++ b/lib/tasks/cleanup.rake
@@ -0,0 +1,33 @@
+namespace :gitlab do
+ namespace :cleanup do
+ 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
+ end
+end