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
92290ece
Commit
92290ece
authored
Jan 14, 2021
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separatelly report migrated and failed projects
parent
09210823
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lib/tasks/gitlab/pages.rake
lib/tasks/gitlab/pages.rake
+10
-3
No files found.
lib/tasks/gitlab/pages.rake
View file @
92290ece
...
@@ -6,7 +6,8 @@ namespace :gitlab do
...
@@ -6,7 +6,8 @@ namespace :gitlab do
task
migrate_legacy_storage: :gitlab_environment
do
task
migrate_legacy_storage: :gitlab_environment
do
logger
=
Logger
.
new
(
STDOUT
)
logger
=
Logger
.
new
(
STDOUT
)
logger
.
info
(
'Starting to migrate legacy pages storage to zip deployments'
)
logger
.
info
(
'Starting to migrate legacy pages storage to zip deployments'
)
processed_projects
=
0
projects_migrated
=
0
projects_errored
=
0
ProjectPagesMetadatum
.
only_on_legacy_storage
.
each_batch
(
of:
10
)
do
|
batch
|
ProjectPagesMetadatum
.
only_on_legacy_storage
.
each_batch
(
of:
10
)
do
|
batch
|
batch
.
preload
(
project:
[
:namespace
,
:route
,
pages_metadatum: :pages_deployment
]).
each
do
|
metadatum
|
batch
.
preload
(
project:
[
:namespace
,
:route
,
pages_metadatum: :pages_deployment
]).
each
do
|
metadatum
|
...
@@ -16,20 +17,26 @@ namespace :gitlab do
...
@@ -16,20 +17,26 @@ namespace :gitlab do
time
=
Benchmark
.
realtime
do
time
=
Benchmark
.
realtime
do
result
=
::
Pages
::
MigrateLegacyStorageToDeploymentService
.
new
(
project
).
execute
result
=
::
Pages
::
MigrateLegacyStorageToDeploymentService
.
new
(
project
).
execute
end
end
processed_projects
+=
1
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
logger
.
info
(
"project_id:
#{
project
.
id
}
#{
project
.
pages_path
}
has been migrated in
#{
time
}
seconds"
)
logger
.
info
(
"project_id:
#{
project
.
id
}
#{
project
.
pages_path
}
has been migrated in
#{
time
}
seconds"
)
projects_migrated
+=
1
else
else
logger
.
error
(
"project_id:
#{
project
.
id
}
#{
project
.
pages_path
}
failed to be migrated in
#{
time
}
seconds:
#{
result
[
:message
]
}
"
)
logger
.
error
(
"project_id:
#{
project
.
id
}
#{
project
.
pages_path
}
failed to be migrated in
#{
time
}
seconds:
#{
result
[
:message
]
}
"
)
projects_errored
+=
1
end
end
rescue
=>
e
rescue
=>
e
projects_errored
+=
1
logger
.
error
(
"
#{
e
.
message
}
project_id:
#{
project
&
.
id
}
"
)
logger
.
error
(
"
#{
e
.
message
}
project_id:
#{
project
&
.
id
}
"
)
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
project_id:
project
&
.
id
)
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
project_id:
project
&
.
id
)
end
end
logger
.
info
(
"
#{
pro
cessed_projects
}
pages projects are process
ed"
)
logger
.
info
(
"
#{
pro
jects_migrated
}
projects are migrated successfully,
#{
projects_errored
}
projects failed to be migrat
ed"
)
end
end
logger
.
info
(
"A total of
#{
projects_migrated
+
projects_errored
}
projects were processed."
)
logger
.
info
(
"- The
#{
projects_migrated
}
projects migrated successfully"
)
logger
.
info
(
"- The
#{
projects_errored
}
projects failed to be migrated"
)
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