diff options
Diffstat (limited to 'app/services/projects')
5 files changed, 27 insertions, 19 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index b7ed9202b01..aef92b8adee 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -28,9 +28,7 @@ module Projects # Git data (e.g. a list of branch names). flush_caches(project) - if Feature.enabled?(:abort_deleted_project_pipelines, default_enabled: :yaml) - ::Ci::AbortPipelinesService.new.execute(project.all_pipelines, :project_deleted) - end + ::Ci::AbortPipelinesService.new.execute(project.all_pipelines, :project_deleted) Projects::UnlinkForkService.new(project, current_user).execute @@ -75,6 +73,18 @@ module Projects response.success? end + def destroy_events! + unless remove_events + raise_error(s_('DeleteProject|Failed to remove events. Please try again or contact administrator.')) + end + end + + def remove_events + response = ::Events::DestroyService.new(project).execute + + response.success? + end + def remove_repository(repository) return true unless repository @@ -117,14 +127,10 @@ module Projects log_destroy_event trash_relation_repositories! trash_project_repositories! + destroy_events! destroy_web_hooks! destroy_project_bots! - - if ::Feature.enabled?(:ci_optimize_project_records_destruction, project, default_enabled: :yaml) && - Feature.enabled?(:abort_deleted_project_pipelines, default_enabled: :yaml) - - destroy_ci_records! - end + destroy_ci_records! # Rails attempts to load all related records into memory before # destroying: https://github.com/rails/rails/issues/22510 @@ -150,7 +156,7 @@ module Projects ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline) end - deleted_count = project.commit_statuses.delete_all + deleted_count = ::CommitStatus.for_project(project).delete_all Gitlab::AppLogger.info( class: 'Projects::DestroyService', diff --git a/app/services/projects/prometheus/alerts/create_service.rb b/app/services/projects/prometheus/alerts/create_service.rb index dc0cacf49f3..0d7d8ab1a62 100644 --- a/app/services/projects/prometheus/alerts/create_service.rb +++ b/app/services/projects/prometheus/alerts/create_service.rb @@ -3,7 +3,7 @@ module Projects module Prometheus module Alerts - class CreateService < BaseService + class CreateService < BaseProjectService include AlertParams def execute diff --git a/app/services/projects/prometheus/alerts/destroy_service.rb b/app/services/projects/prometheus/alerts/destroy_service.rb index 14e88a2e356..243b12eb654 100644 --- a/app/services/projects/prometheus/alerts/destroy_service.rb +++ b/app/services/projects/prometheus/alerts/destroy_service.rb @@ -3,7 +3,7 @@ module Projects module Prometheus module Alerts - class DestroyService < BaseService + class DestroyService < BaseProjectService def execute(alert) alert.destroy end diff --git a/app/services/projects/prometheus/alerts/update_service.rb b/app/services/projects/prometheus/alerts/update_service.rb index a0c8a5ccc2d..1802f35dae9 100644 --- a/app/services/projects/prometheus/alerts/update_service.rb +++ b/app/services/projects/prometheus/alerts/update_service.rb @@ -3,7 +3,7 @@ module Projects module Prometheus module Alerts - class UpdateService < BaseService + class UpdateService < BaseProjectService include AlertParams def execute(alert) diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index a69e6488ebc..17da77fe950 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -104,10 +104,10 @@ module Projects update_repository_configuration(@new_path) execute_system_hooks - - update_pending_builds! end + update_pending_builds + post_update_hooks(project) rescue Exception # rubocop:disable Lint/RescueException rollback_side_effects @@ -244,13 +244,15 @@ module Projects Integration.create_from_active_default_integrations(project, :project_id) end - def update_pending_builds! - update_params = { + def update_pending_builds + ::Ci::PendingBuilds::UpdateProjectWorker.perform_async(project.id, pending_builds_params) + end + + def pending_builds_params + { namespace_id: new_namespace.id, namespace_traversal_ids: new_namespace.traversal_ids } - - ::Ci::UpdatePendingBuildService.new(project, update_params).execute end end end |