00f0d356b7
Introduces the concept of Prerequisites for a CI build. If a build has unmet prerequisites it will go through the :preparing state before being made available to a runner. There are no actual prerequisites yet, so current behaviour is unchanged.
25 lines
371 B
Ruby
25 lines
371 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Ci
|
|
class PrepareBuildService
|
|
attr_reader :build
|
|
|
|
def initialize(build)
|
|
@build = build
|
|
end
|
|
|
|
def execute
|
|
prerequisites.each(&:complete!)
|
|
|
|
unless build.enqueue
|
|
build.drop!(:unmet_prerequisites)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def prerequisites
|
|
build.prerequisites
|
|
end
|
|
end
|
|
end
|