def _local_image(name: str, **kwargs: Any) -> targets.LocalImage: """Build a `LocalImage` from its name, with sane defaults. Build-specific information is left to the caller, as each image will require its own set of particularities. """ image_info = _get_image_info(name) kwargs.setdefault('destination', constants.ISO_IMAGE_ROOT) kwargs.setdefault('dockerfile', constants.ROOT / 'images' / name / 'Dockerfile') kwargs.setdefault('save_on_disk', True) kwargs.setdefault('task_dep', ['_image_mkdir_root']) return targets.LocalImage( name=name, version=image_info.version, **kwargs, )
yield from repository.execution_plan # }}} # Builders {{{ # Image used to build the packages RPM_BUILDER: targets.LocalImage = targets.LocalImage( name='metalk8s-rpm-build', version='latest', dockerfile=constants.ROOT / 'packages' / 'redhat' / 'Dockerfile', destination=config.BUILD_ROOT, save_on_disk=False, task_dep=['_build_root'], file_dep=[ constants.ROOT.joinpath('packages', 'redhat', 'yum_repositories', 'kubernetes.repo'), constants.ROOT.joinpath('packages', 'redhat', 'yum_repositories', 'saltstack.repo') ], build_args={ # Used to template the SaltStack repository definition 'SALT_VERSION': versions.SALT_VERSION, }, ) DEB_BUILDER: targets.LocalImage = targets.LocalImage( name='metalk8s-deb-build', version='latest', dockerfile=constants.ROOT / 'packages' / 'debian' / 'Dockerfile', destination=config.BUILD_ROOT, save_on_disk=False,
# in the image needs to be updated. # This should be reset to 1 when SALT_VERSION is changed. SALT_MASTER_BUILD_ID: int = 1 KEEPALIVED_IMAGE_TAG = '{}-{}'.format( constants.KEEPALIVED_VERSION, constants.KEEPALIVED_BUILD_ID, ) # List of container images to build. TO_BUILD: Tuple[targets.LocalImage, ...] = ( targets.LocalImage( name='salt-master', version='{}-{}'.format(constants.SALT_VERSION, SALT_MASTER_BUILD_ID), dockerfile=constants.ROOT / 'images' / 'salt-master' / 'Dockerfile', destination=constants.ISO_IMAGE_ROOT, save_on_disk=True, build_args={'SALT_VERSION': constants.SALT_VERSION}, task_dep=['_image_mkdir_root'], file_dep=[constants.ROOT / 'images' / 'salt-master' / 'source.key'], ), targets.LocalImage( name='keepalived', version=KEEPALIVED_IMAGE_TAG, dockerfile=constants.ROOT / 'images' / 'keepalived' / 'Dockerfile', destination=constants.ISO_IMAGE_ROOT, save_on_disk=True, build_args={ 'KEEPALIVED_IMAGE_SHA256': constants.CENTOS_BASE_IMAGE_SHA256, 'KEEPALIVED_IMAGE': constants.CENTOS_BASE_IMAGE,
yield from package.execution_plan def task__build_repositories() -> Iterator[types.TaskDict]: """Build a repository.""" for repository in REPOSITORIES: yield from repository.execution_plan # Image used to build the packages BUILDER: targets.LocalImage = targets.LocalImage( name='metalk8s-build', version='latest', dockerfile=constants.ROOT / 'packages' / 'Dockerfile', destination=config.BUILD_ROOT, save_on_disk=False, task_dep=['_build_root'], file_dep=[ constants.ROOT / 'packages/yum_repositories/kubernetes.repo', constants.ROOT / 'packages/yum_repositories/saltstack.repo' ], ) CALICO_CNI_PLUGIN_VERSION: str = '3.7.2' # Packages per repository. PACKAGES: Dict[str, Tuple[targets.Package, ...]] = { 'scality': ( # Calico Container Network Interface Plugin. targets.Package( basename='_build_packages', name='calico-cni-plugin', version=CALICO_CNI_PLUGIN_VERSION,