def get_image_references(result, kiwi_file, version, release): references = {} config = result.xml_state.get_container_config() if 'container_name' not in config: config['container_name'] = Defaults.get_default_container_name() config['container_tag'] = Defaults.get_default_container_tag() if 'container_tag' not in config: config['container_tag'] = Defaults.get_default_container_tag() references[config['container_name']] = [config['container_tag']] if 'additional_tags' in config: references[config['container_name']].extend(config['additional_tags']) return add_additional_OBS_references(kiwi_file, version, release, references)
def __init__(self, root_dir, transport, custom_args=None): self.root_dir = root_dir self.archive_transport = transport if custom_args: self.oci_config = custom_args else: self.oci_config = {} self.runtime_config = RuntimeConfig() # for builds inside the buildservice we include a reference to the # specific build. Thus disturl label only exists inside the # buildservice. if Defaults.is_buildservice_worker(): bs_label = 'org.openbuildservice.disturl' # Do not label anything if the build service label is # already present if 'labels' not in self.oci_config or \ bs_label not in self.oci_config['labels']: self._append_buildservice_disturl_label() if 'container_name' not in self.oci_config: log.info( 'No container configuration provided, ' 'using default container name "kiwi-container:latest"' ) self.oci_config['container_name'] = \ Defaults.get_default_container_name() self.oci_config['container_tag'] = \ Defaults.get_default_container_tag() if 'container_tag' not in self.oci_config: self.oci_config['container_tag'] = \ Defaults.get_default_container_tag() if 'entry_command' not in self.oci_config and \ 'entry_subcommand' not in self.oci_config: self.oci_config['entry_subcommand'] = \ Defaults.get_default_container_subcommand() if 'history' not in self.oci_config: self.oci_config['history'] = {} if 'created_by' not in self.oci_config['history']: self.oci_config['history']['created_by'] = \ Defaults.get_default_container_created_by()
def __init__(self, root_dir, custom_args=None): # noqa: C901 self.root_dir = root_dir self.oci_dir = None self.oci_root_dir = None self.container_name = Defaults.get_default_container_name() self.container_tag = Defaults.get_default_container_tag() self.additional_tags = [] self.entry_command = [] self.entry_subcommand = [] self.maintainer = [] self.user = [] self.workingdir = [] self.expose_ports = [] self.volumes = [] self.environment = [] self.labels = [] self.runtime_config = RuntimeConfig() if custom_args: if 'container_name' in custom_args: self.container_name = custom_args['container_name'] if 'container_tag' in custom_args: self.container_tag = custom_args['container_tag'] if 'additional_tags' in custom_args: self.additional_tags = custom_args['additional_tags'] if 'entry_command' in custom_args: self.entry_command = custom_args['entry_command'] if 'entry_subcommand' in custom_args: self.entry_subcommand = custom_args['entry_subcommand'] if 'maintainer' in custom_args: self.maintainer = custom_args['maintainer'] if 'user' in custom_args: self.user = custom_args['user'] if 'workingdir' in custom_args: self.workingdir = custom_args['workingdir'] if 'expose_ports' in custom_args: self.expose_ports = custom_args['expose_ports'] if 'volumes' in custom_args: self.volumes = custom_args['volumes'] if 'environment' in custom_args: self.environment = custom_args['environment'] if 'labels' in custom_args: self.labels = custom_args['labels'] # for builds inside the buildservice we include a reference to the # specific build. Thus disturl label only exists inside the # buildservice. if Defaults.is_buildservice_worker(): bs_label = 'org.openbuildservice.disturl' # Do not label anything if any build service label is # already present if not [label for label in self.labels if bs_label in label]: self._append_buildservice_disturl_label() if not custom_args or 'container_name' not in custom_args: log.info('No container configuration provided, ' 'using default container name "kiwi-container:latest"') if not self.entry_command and not self.entry_subcommand: self.entry_subcommand = ['--config.cmd=/bin/bash']