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-04-14 21:09:30 -04:00
|
|
|
build.enqueue!
|
|
|
|
rescue => e
|
|
|
|
Gitlab::Sentry.track_acceptable_exception(e, extra: { build_id: build.id })
|
|
|
|
|
|
|
|
build.drop(:unmet_prerequisites)
|
2019-03-03 18:56:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def prerequisites
|
|
|
|
build.prerequisites
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|