2019-08-30 18:22:24 +01:00
|
|
|
class Pipeline::Validation::ValidateBuild
|
2019-08-14 07:29:43 +01:00
|
|
|
include Mandate
|
|
|
|
|
|
2019-08-15 09:57:18 +01:00
|
|
|
initialize_with :build_tag, :fixtures_folder
|
2019-08-14 07:29:43 +01:00
|
|
|
|
|
|
|
|
def call
|
|
|
|
|
unpack
|
|
|
|
|
check_environment_is_invokable
|
|
|
|
|
check_environment_invariants
|
|
|
|
|
check_sample_solutions
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def unpack
|
2019-08-14 20:58:30 +01:00
|
|
|
container_driver.prepare_workdir
|
|
|
|
|
container_driver.unpack_image(build_tag)
|
2019-08-14 07:29:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_environment_is_invokable
|
2019-08-14 20:58:30 +01:00
|
|
|
Pipeline::Validation::CheckInvokable.(container_driver)
|
2019-08-14 07:29:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_environment_invariants
|
2019-08-14 20:58:30 +01:00
|
|
|
Pipeline::Validation::CheckEnvironmentInvariants.(container_driver)
|
2019-08-14 07:29:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_sample_solutions
|
2019-08-15 09:57:18 +01:00
|
|
|
Pipeline::Validation::CheckFixtures.(container_driver, fixtures_folder)
|
2019-08-14 07:29:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
memoize
|
|
|
|
|
def workdir
|
|
|
|
|
"/tmp/analyzer-scratch/#{SecureRandom.uuid}"
|
|
|
|
|
end
|
|
|
|
|
|
2019-08-14 20:58:30 +01:00
|
|
|
memoize
|
|
|
|
|
def container_driver
|
2019-10-04 14:24:15 +01:00
|
|
|
@logs = Pipeline::Util::LogCollector.new
|
|
|
|
|
img = Pipeline::Util::ImgWrapper.new(@logs)
|
|
|
|
|
runc = Pipeline::Util::RuncWrapper.new(@logs)
|
2019-08-14 20:58:30 +01:00
|
|
|
configurator = Pipeline::Util::RuncConfigurator.new
|
2019-08-14 08:53:09 +01:00
|
|
|
configurator.seed_from_env
|
2019-08-14 20:58:30 +01:00
|
|
|
Pipeline::Util::ContainerDriver.new(runc, img, configurator, workdir)
|
2019-08-14 07:29:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|