summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/ci/pipeline/retry.rb
blob: ee93f99703e4f9f18feb0ca9c90c5b5dcdecf95a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Mutations
  module Ci
    module Pipeline
      class Retry < Base
        graphql_name 'PipelineRetry'

        field :pipeline,
              Types::Ci::PipelineType,
              null: true,
              description: 'Pipeline after mutation.'

        authorize :update_pipeline

        def resolve(id:)
          pipeline = authorized_find!(id: id)
          project = pipeline.project

          ::Ci::RetryPipelineService.new(project, current_user).execute(pipeline)
          {
            pipeline: pipeline,
            errors: errors_on_object(pipeline)
          }
        end
      end
    end
  end
end