summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/chain/seed_block.rb
blob: 67424635603fcc6d73598748c66a129bc6b6e379 (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
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        class SeedBlock < Chain::Base
          include Chain::Helpers
          include Gitlab::Utils::StrongMemoize

          def perform!
            ##
            # Populate pipeline with block argument of CreatePipelineService#execute.
            #
            @command.seeds_block&.call(pipeline)

            raise "Pipeline cannot be persisted by `seeds_block`" if pipeline.persisted?
          end

          def break?
            pipeline.errors.any?
          end
        end
      end
    end
  end
end