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
199c5f1c
Commit
199c5f1c
authored
Feb 08, 2021
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark legacy pages removal for being deleted
parent
b3daa3e5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
11 deletions
+12
-11
app/models/project.rb
app/models/project.rb
+3
-4
app/services/pages/delete_service.rb
app/services/pages/delete_service.rb
+1
-0
app/workers/pages_remove_worker.rb
app/workers/pages_remove_worker.rb
+2
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-4
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+1
-1
spec/workers/namespaceless_project_destroy_worker_spec.rb
spec/workers/namespaceless_project_destroy_worker_spec.rb
+1
-1
No files found.
app/models/project.rb
View file @
199c5f1c
...
...
@@ -117,7 +117,7 @@ class Project < ApplicationRecord
use_fast_destroy
:build_trace_chunks
after_destroy
->
{
run_after_commit
{
remove_pages
}
}
after_destroy
->
{
run_after_commit
{
legacy_
remove_pages
}
}
after_destroy
:remove_exports
after_validation
:check_pending_delete
...
...
@@ -1788,10 +1788,9 @@ class Project < ApplicationRecord
.
delete_all
end
# TODO: what to do here when not using Legacy Storage? Do we still need to rename and delay removal?
# answer: we should just remove all of this
# TODO: remove this method https://gitlab.com/gitlab-org/gitlab/-/issues/320775
# rubocop: disable CodeReuse/ServiceClass
def
remove_pages
def
legacy_
remove_pages
return
unless
Feature
.
enabled?
(
:pages_update_legacy_storage
,
default_enabled:
true
)
# Projects with a missing namespace cannot have their pages removed
...
...
app/services/pages/delete_service.rb
View file @
199c5f1c
...
...
@@ -8,6 +8,7 @@ module Pages
DestroyPagesDeploymentsWorker
.
perform_async
(
project
.
id
)
# TODO: remove this call https://gitlab.com/gitlab-org/gitlab/-/issues/320775
PagesRemoveWorker
.
perform_async
(
project
.
id
)
if
Feature
.
enabled?
(
:pages_update_legacy_storage
,
default_enabled:
true
)
end
end
...
...
app/workers/pages_remove_worker.rb
View file @
199c5f1c
# frozen_string_literal: true
# TODO: remove this worker https://gitlab.com/gitlab-org/gitlab/-/issues/320775
class
PagesRemoveWorker
# rubocop:disable Scalability/IdempotentWorker
include
ApplicationWorker
...
...
@@ -11,6 +12,6 @@ class PagesRemoveWorker # rubocop:disable Scalability/IdempotentWorker
project
=
Project
.
find_by_id
(
project_id
)
return
unless
project
project
.
remove_pages
project
.
legacy_
remove_pages
end
end
spec/models/project_spec.rb
View file @
199c5f1c
...
...
@@ -4117,7 +4117,7 @@ RSpec.describe Project, factory_default: :keep do
end
end
describe
'#remove_pages'
do
describe
'#
legacy_
remove_pages'
do
let
(
:project
)
{
create
(
:project
).
tap
{
|
project
|
project
.
mark_pages_as_deployed
}
}
let
(
:pages_metadatum
)
{
project
.
pages_metadatum
}
let
(
:namespace
)
{
project
.
namespace
}
...
...
@@ -4136,7 +4136,7 @@ RSpec.describe Project, factory_default: :keep do
expect_any_instance_of
(
Gitlab
::
PagesTransfer
).
to
receive
(
:rename_project
).
and_return
(
true
)
expect
(
PagesWorker
).
to
receive
(
:perform_in
).
with
(
5
.
minutes
,
:remove
,
namespace
.
full_path
,
anything
)
expect
{
project
.
remove_pages
}.
to
change
{
pages_metadatum
.
reload
.
deployed
}.
from
(
true
).
to
(
false
)
expect
{
project
.
legacy_
remove_pages
}.
to
change
{
pages_metadatum
.
reload
.
deployed
}.
from
(
true
).
to
(
false
)
end
it
'does nothing if updates on legacy storage are disabled'
do
...
...
@@ -4145,11 +4145,11 @@ RSpec.describe Project, factory_default: :keep do
expect
(
Gitlab
::
PagesTransfer
).
not_to
receive
(
:new
)
expect
(
PagesWorker
).
not_to
receive
(
:perform_in
)
project
.
remove_pages
project
.
legacy_
remove_pages
end
it
'is run when the project is destroyed'
do
expect
(
project
).
to
receive
(
:remove_pages
).
and_call_original
expect
(
project
).
to
receive
(
:
legacy_
remove_pages
).
and_call_original
expect
{
project
.
destroy
}.
not_to
raise_error
end
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
199c5f1c
...
...
@@ -16,7 +16,7 @@ RSpec.describe Projects::UpdatePagesService do
subject
{
described_class
.
new
(
project
,
build
)
}
before
do
project
.
remove_pages
project
.
legacy_
remove_pages
end
context
'::TMP_EXTRACT_PATH'
do
...
...
spec/workers/namespaceless_project_destroy_worker_spec.rb
View file @
199c5f1c
...
...
@@ -49,7 +49,7 @@ RSpec.describe NamespacelessProjectDestroyWorker do
subject
.
perform
(
project
.
id
)
end
it
'does not do anything in Project#remove_pages method'
do
it
'does not do anything in Project#
legacy_
remove_pages method'
do
expect
(
Gitlab
::
PagesTransfer
).
not_to
receive
(
:new
)
subject
.
perform
(
project
.
id
)
...
...
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