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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
5e861a05
Commit
5e861a05
authored
Nov 21, 2017
by
Brett Walker
Committed by
Stan Hu
Nov 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore hashed repos (for now) when using `rake gitlab:cleanup:repos`
parent
04c43806
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+4
-1
spec/tasks/gitlab/cleanup_rake_spec.rb
spec/tasks/gitlab/cleanup_rake_spec.rb
+41
-0
No files found.
lib/tasks/gitlab/cleanup.rake
View file @
5e861a05
...
...
@@ -59,7 +59,10 @@ namespace :gitlab do
.
sub
(
%r{^/*}
,
''
)
.
chomp
(
'.git'
)
.
chomp
(
'.wiki'
)
next
if
Project
.
find_by_full_path
(
repo_with_namespace
)
# TODO ignoring hashed repositories for now. But revisit to fully support
# possible orphaned hashed repos
next
if
repo_with_namespace
.
start_with?
(
'@hashed/'
)
||
Project
.
find_by_full_path
(
repo_with_namespace
)
new_path
=
path
+
move_suffix
puts
path
.
inspect
+
' -> '
+
new_path
.
inspect
...
...
spec/tasks/gitlab/cleanup_rake_spec.rb
0 → 100644
View file @
5e861a05
require
'rake_helper'
describe
'gitlab:cleanup rake tasks'
do
before
do
Rake
.
application
.
rake_require
'tasks/gitlab/cleanup'
end
context
'cleanup repositories'
do
let
(
:gitaly_address
)
{
Gitlab
.
config
.
repositories
.
storages
.
default
.
gitaly_address
}
let
(
:storages
)
do
{
'default'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/default_storage'
),
'gitaly_address'
=>
gitaly_address
}
}
end
before
do
FileUtils
.
mkdir
(
Settings
.
absolute
(
'tmp/tests/default_storage'
))
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
end
after
do
FileUtils
.
rm_rf
(
Settings
.
absolute
(
'tmp/tests/default_storage'
))
end
it
'moves it to an orphaned path'
do
FileUtils
.
mkdir_p
(
Settings
.
absolute
(
'tmp/tests/default_storage/broken/project.git'
))
run_rake_task
(
'gitlab:cleanup:repos'
)
repo_list
=
Dir
[
'tmp/tests/default_storage/broken/*'
]
expect
(
repo_list
.
first
).
to
include
(
'+orphaned+'
)
end
it
'ignores @hashed repos'
do
FileUtils
.
mkdir_p
(
Settings
.
absolute
(
'tmp/tests/default_storage/@hashed/12/34/5678.git'
))
run_rake_task
(
'gitlab:cleanup:repos'
)
expect
(
Dir
.
exist?
(
Settings
.
absolute
(
'tmp/tests/default_storage/@hashed/12/34/5678.git'
))).
to
be_truthy
end
end
end
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