debian-mirror-gitlab/app/services/ci/destroy_pipeline_service.rb
2019-07-31 17:26:46 +00:00

13 lines
330 B
Ruby

# frozen_string_literal: true
module Ci
class DestroyPipelineService < BaseService
def execute(pipeline)
raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_pipeline, pipeline)
Ci::ExpirePipelineCacheService.new.execute(pipeline, delete: true)
pipeline.destroy!
end
end
end