2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PrepareBuildService
|
|
|
|
attr_reader :build
|
|
|
|
|
|
|
|
def initialize(build)
|
|
|
|
@build = build
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
prerequisites.each(&:complete!)
|
|
|
|
|
|
|
|
build.enqueue!
|
|
|
|
rescue => e
|
2020-01-01 13:55:28 +05:30
|
|
|
Gitlab::ErrorTracking.track_exception(e, build_id: build.id)
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
build.drop(:unmet_prerequisites)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def prerequisites
|
|
|
|
build.prerequisites
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|