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
d17b45ad
Commit
d17b45ad
authored
May 21, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assign helper full name to variable to reduce code length
parent
818b4d0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
lib/tasks/gitlab/storage.rake
lib/tasks/gitlab/storage.rake
+19
-10
No files found.
lib/tasks/gitlab/storage.rake
View file @
d17b45ad
...
@@ -3,6 +3,7 @@ namespace :gitlab do
...
@@ -3,6 +3,7 @@ namespace :gitlab do
desc
'GitLab | Storage | Migrate existing projects to Hashed Storage'
desc
'GitLab | Storage | Migrate existing projects to Hashed Storage'
task
migrate_to_hashed: :environment
do
task
migrate_to_hashed: :environment
do
legacy_projects_count
=
Project
.
with_unmigrated_storage
.
count
legacy_projects_count
=
Project
.
with_unmigrated_storage
.
count
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
if
legacy_projects_count
==
0
if
legacy_projects_count
==
0
puts
'There are no projects requiring storage migration. Nothing to do!'
puts
'There are no projects requiring storage migration. Nothing to do!'
...
@@ -10,9 +11,9 @@ namespace :gitlab do
...
@@ -10,9 +11,9 @@ namespace :gitlab do
next
next
end
end
print
"Enqueuing migration of
#{
legacy_projects_count
}
projects in batches of
#{
Gitlab
::
HashedStorage
::
RakeH
elper
.
batch_size
}
"
print
"Enqueuing migration of
#{
legacy_projects_count
}
projects in batches of
#{
h
elper
.
batch_size
}
"
Gitlab
::
HashedStorage
::
RakeH
elper
.
project_id_batches
do
|
start
,
finish
|
h
elper
.
project_id_batches
do
|
start
,
finish
|
StorageMigratorWorker
.
perform_async
(
start
,
finish
)
StorageMigratorWorker
.
perform_async
(
start
,
finish
)
print
'.'
print
'.'
...
@@ -23,42 +24,50 @@ namespace :gitlab do
...
@@ -23,42 +24,50 @@ namespace :gitlab do
desc
'Gitlab | Storage | Summary of existing projects using Legacy Storage'
desc
'Gitlab | Storage | Summary of existing projects using Legacy Storage'
task
legacy_projects: :environment
do
task
legacy_projects: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
relation_summary
(
'projects'
,
Project
.
without_storage_feature
(
:repository
))
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
relation_summary
(
'projects'
,
Project
.
without_storage_feature
(
:repository
))
end
end
desc
'Gitlab | Storage | List existing projects using Legacy Storage'
desc
'Gitlab | Storage | List existing projects using Legacy Storage'
task
list_legacy_projects: :environment
do
task
list_legacy_projects: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
projects_list
(
'projects using Legacy Storage'
,
Project
.
without_storage_feature
(
:repository
))
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
projects_list
(
'projects using Legacy Storage'
,
Project
.
without_storage_feature
(
:repository
))
end
end
desc
'Gitlab | Storage | Summary of existing projects using Hashed Storage'
desc
'Gitlab | Storage | Summary of existing projects using Hashed Storage'
task
hashed_projects: :environment
do
task
hashed_projects: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
relation_summary
(
'projects using Hashed Storage'
,
Project
.
with_storage_feature
(
:repository
))
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
relation_summary
(
'projects using Hashed Storage'
,
Project
.
with_storage_feature
(
:repository
))
end
end
desc
'Gitlab | Storage | List existing projects using Hashed Storage'
desc
'Gitlab | Storage | List existing projects using Hashed Storage'
task
list_hashed_projects: :environment
do
task
list_hashed_projects: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
projects_list
(
'projects using Hashed Storage'
,
Project
.
with_storage_feature
(
:repository
))
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
projects_list
(
'projects using Hashed Storage'
,
Project
.
with_storage_feature
(
:repository
))
end
end
desc
'Gitlab | Storage | Summary of project attachments using Legacy Storage'
desc
'Gitlab | Storage | Summary of project attachments using Legacy Storage'
task
legacy_attachments: :environment
do
task
legacy_attachments: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
relation_summary
(
'attachments using Legacy Storage'
,
Gitlab
::
HashedStorage
::
RakeHelper
.
legacy_attachments_relation
)
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
relation_summary
(
'attachments using Legacy Storage'
,
helper
.
legacy_attachments_relation
)
end
end
desc
'Gitlab | Storage | List existing project attachments using Legacy Storage'
desc
'Gitlab | Storage | List existing project attachments using Legacy Storage'
task
list_legacy_attachments: :environment
do
task
list_legacy_attachments: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
attachments_list
(
'attachments using Legacy Storage'
,
Gitlab
::
HashedStorage
::
RakeHelper
.
legacy_attachments_relation
)
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
attachments_list
(
'attachments using Legacy Storage'
,
helper
.
legacy_attachments_relation
)
end
end
desc
'Gitlab | Storage | Summary of project attachments using Hashed Storage'
desc
'Gitlab | Storage | Summary of project attachments using Hashed Storage'
task
hashed_attachments: :environment
do
task
hashed_attachments: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
relation_summary
(
'attachments using Hashed Storage'
,
Gitlab
::
HashedStorage
::
RakeHelper
.
hashed_attachments_relation
)
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
relation_summary
(
'attachments using Hashed Storage'
,
helper
.
hashed_attachments_relation
)
end
end
desc
'Gitlab | Storage | List existing project attachments using Hashed Storage'
desc
'Gitlab | Storage | List existing project attachments using Hashed Storage'
task
list_hashed_attachments: :environment
do
task
list_hashed_attachments: :environment
do
Gitlab
::
HashedStorage
::
RakeHelper
.
attachments_list
(
'attachments using Hashed Storage'
,
Gitlab
::
HashedStorage
::
RakeHelper
.
hashed_attachments_relation
)
helper
=
Gitlab
::
HashedStorage
::
RakeHelper
helper
.
attachments_list
(
'attachments using Hashed Storage'
,
helper
.
hashed_attachments_relation
)
end
end
end
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