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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
21768207
Commit
21768207
authored
Jul 21, 2016
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rake task to remove old repository copies from repositories moved to another storage
parent
a6aa6312
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
CHANGELOG-EE
CHANGELOG-EE
+1
-0
doc/raketasks/cleanup.md
doc/raketasks/cleanup.md
+10
-0
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+28
-0
No files found.
CHANGELOG-EE
View file @
21768207
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased)
- Allow projects to be moved between repository storages
- Add rake task to remove old repository copies from repositories moved to another storage
- Performance improvement of push rules
- Change LdapGroupSyncWorker to use new LDAP group sync classes
- [Elastic][Fix] Commit search breaks for some URLs on gitlab-ce project
...
...
doc/raketasks/cleanup.md
View file @
21768207
...
...
@@ -22,3 +22,13 @@ sudo gitlab-rake gitlab:cleanup:repos
# installation from source
bundle exec rake gitlab:cleanup:repos RAILS_ENV=production
```
Remove old repository copies from repositories moved to another storage.
```
# omnibus-gitlab
sudo gitlab-rake gitlab:cleanup:moved
# installation from source
bundle exec rake gitlab:cleanup:moved RAILS_ENV=production
```
lib/tasks/gitlab/cleanup.rake
View file @
21768207
...
...
@@ -43,6 +43,34 @@ namespace :gitlab do
end
end
desc
"GitLab | Cleanup | Delete moved repositories"
task
moved: :environment
do
warn_user_is_not_gitlab
remove_flag
=
ENV
[
'REMOVE'
]
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repo_root
|
# Look for global repos (legacy, depth 1) and normal repos (depth 2)
IO
.
popen
(
%W(find
#{
repo_root
.
chomp
(
'/'
)
}
-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: :environment
do
warn_user_is_not_gitlab
...
...
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