2019-03-03 18:56:20 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PrepareBuildService
|
|
|
|
attr_reader :build
|
|
|
|
|
|
|
|
def initialize(build)
|
|
|
|
@build = build
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
prerequisites.each(&:complete!)
|
|
|
|
|
2019-12-24 07:08:01 -05:00
|
|
|
build.enqueue_preparing!
|
2021-04-26 08:09:44 -04:00
|
|
|
rescue StandardError => e
|
2019-12-16 07:07:43 -05:00
|
|
|
Gitlab::ErrorTracking.track_exception(e, build_id: build.id)
|
2019-04-14 21:09:30 -04:00
|
|
|
|
|
|
|
build.drop(:unmet_prerequisites)
|
2019-03-03 18:56:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def prerequisites
|
|
|
|
build.prerequisites
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|