Example #1
0
def base_build(parameters):
    version = ASSERT.not_none(parameters['%s/version' % shipyard2.BASE])
    image_paths = [
        utils.get_image_path(parameters, shipyard2.BASE),
        utils.get_builder_image_path(parameters, shipyard2.BASE),
    ]
    if all(map(Path.is_file, image_paths)):
        LOG.info('skip: build base: %s %s', version, image_paths)
        return
    ASSERT.not_any(image_paths, Path.is_file)
    LOG.info('build base: %s %s', version, image_paths)
    for image_path in image_paths:
        scripts.mkdir(image_path.parent)
    with contextlib.ExitStack() as stack:
        _build_base(stack, version, image_paths[0], image_paths[1])
    for image_path in image_paths:
        utils.chown(image_path)
    with scripts.using_sudo():
        for image_path in image_paths:
            ctr_scripts.ctr_import_image(image_path)
Example #2
0
 def __post_init__(self):
     # The current implementation does not resolve any unit name
     # conflicts.
     ASSERT.unique(self.units, lambda unit: unit.name)
     ASSERT.not_any(key.startswith(ENV_PREFIX) for key in self.envs)