debian-mirror-gitlab/app/graphql/mutations/ci/pipeline/destroy.rb
2022-07-29 14:03:07 +02:00

37 lines
974 B
Ruby

# frozen_string_literal: true
module Mutations
module Ci
module Pipeline
class Destroy < Base
graphql_name 'PipelineDestroy'
authorize :destroy_pipeline
def resolve(id:)
pipeline = authorized_find!(id: id)
project = pipeline.project
return undergoing_refresh_error(project) if project.refreshing_build_artifacts_size?
result = ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline)
{
success: result.success?,
errors: result.errors
}
end
private
def undergoing_refresh_error(project)
Gitlab::ProjectStatsRefreshConflictsLogger.warn_request_rejected_during_stats_refresh(project.id)
{
success: false,
errors: ['Action temporarily disabled. The project this pipeline belongs to is undergoing stats refresh.']
}
end
end
end
end
end