Class: Ci::DestroyPipelineService
- Inherits:
-
BaseService
- Object
- BaseService
- Ci::DestroyPipelineService
- Defined in:
- app/services/ci/destroy_pipeline_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::UnauthorizedError
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute(pipeline) ⇒ Object
-
#unsafe_execute(pipelines, skip_cancel: false) ⇒ Object
In this we’re intentionally grouping the operations in batches, starting with the read queries, because we want to use the database replica for as long as possible.
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#execute(pipeline) ⇒ Object
5 6 7 8 9 |
# File 'app/services/ci/destroy_pipeline_service.rb', line 5 def execute(pipeline) raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_pipeline, pipeline) unsafe_execute([pipeline]) end |
#unsafe_execute(pipelines, skip_cancel: false) ⇒ Object
In this we’re intentionally grouping the operations in batches, starting with the read queries, because we want to use the database replica for as long as possible. It is unsafe because the caller needs to ensure proper permissions check.
22 23 24 25 26 27 28 |
# File 'app/services/ci/destroy_pipeline_service.rb', line 22 def unsafe_execute(pipelines, skip_cancel: false) expire_cache(pipelines) cancel_jobs(pipelines) unless skip_cancel reload_and_destroy(pipelines) ServiceResponse.success(message: 'Pipeline not found') end |