summaryrefslogtreecommitdiff
path: root/app/services/ci/prepare_build_service.rb
blob: 3f87c7112706e1271da1cc6d9cfe00144ea8e391 (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 Ci
  class PrepareBuildService
    attr_reader :build

    def initialize(build)
      @build = build
    end

    def execute
      prerequisites.each(&:complete!)

      build.enqueue_preparing!
    rescue => e
      Gitlab::ErrorTracking.track_exception(e, build_id: build.id)

      build.drop(:unmet_prerequisites)
    end

    private

    def prerequisites
      build.prerequisites
    end
  end
end