debian-mirror-gitlab/app/graphql/mutations/ci/pipeline/destroy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
974 B
Ruby
Raw Normal View History

2021-03-08 18:12:59 +05:30
# 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
2022-07-23 23:45:48 +05:30
return undergoing_refresh_error(project) if project.refreshing_build_artifacts_size?
2021-03-08 18:12:59 +05:30
result = ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline)
{
success: result.success?,
errors: result.errors
}
end
2022-07-23 23:45:48 +05:30
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
2021-03-08 18:12:59 +05:30
end
end
end
end