Example #1
0
    def __init__(self, tasker, workflow, target, hub=None, root=None, proxy=None,
                 koji_ssl_certs_dir=None):
        """
        constructor

        :param tasker: DockerTasker instance
        :param workflow: DockerBuildWorkflow instance
        :param target: string, koji target to use as a source
        :param hub: string, koji hub (xmlrpc)
        :param root: string, koji root (storage)
        :param koji_ssl_certs_dir: str, path to "cert", "ca", and "serverca"
            Note that this plugin requires koji_ssl_certs_dir set if Koji
            certificate is not trusted by CA bundle.
        """
        # call parent constructor
        super(KojiPlugin, self).__init__(tasker, workflow)
        self.target = target

        self.koji_fallback = {
            'hub_url': hub,
            'root_url': root,
            'auth': {
                'ssl_certs_dir': koji_ssl_certs_dir
            }
        }

        self.xmlrpc = get_koji_session(self.workflow, self.koji_fallback)
        self.pathinfo = get_koji_path_info(self.workflow, self.koji_fallback)
        self.proxy = get_yum_proxy(self.workflow, proxy)
Example #2
0
    def __init__(self, tasker, workflow, target, hub=None, root=None, proxy=None,
                 koji_ssl_certs_dir=None):
        """
        constructor

        :param tasker: DockerTasker instance
        :param workflow: DockerBuildWorkflow instance
        :param target: string, koji target to use as a source
        :param hub: string, koji hub (xmlrpc)
        :param root: string, koji root (storage)
        :param koji_ssl_certs_dir: str, path to "cert", "ca", and "serverca"
            Note that this plugin requires koji_ssl_certs_dir set if Koji
            certificate is not trusted by CA bundle.
        """
        # call parent constructor
        super(KojiPlugin, self).__init__(tasker, workflow)
        self.target = target

        self.koji_fallback = {
            'hub_url': hub,
            'root_url': root,
            'auth': {
                'ssl_certs_dir': koji_ssl_certs_dir
            }
        }

        self.xmlrpc = get_koji_session(self.workflow, self.koji_fallback)
        self.pathinfo = get_koji_path_info(self.workflow, self.koji_fallback)
        self.proxy = get_yum_proxy(self.workflow, proxy)
Example #3
0
    def __init__(self, tasker, workflow, target=None, proxy=None):
        """
        constructor

        :param tasker: ContainerTasker instance
        :param workflow: DockerBuildWorkflow instance
        :param target: string, koji target to use as a source
        """
        # call parent constructor
        super(KojiPlugin, self).__init__(tasker, workflow)
        self.target = target

        self.xmlrpc = get_koji_session(self.workflow)
        self.pathinfo = get_koji_path_info(self.workflow)
        self.proxy = get_yum_proxy(self.workflow, proxy)
    def adjust_config_kwargs(self):
        koji_fallback = {
            'hub_url': self.config_kwargs.get('koji_hub'),
            'root_url': self.config_kwargs.get('koji_root')
        }
        koji_map = get_koji(self.workflow, koji_fallback)
        self.config_kwargs['koji_hub'] = koji_map['hub_url']
        self.config_kwargs['koji_root'] = koji_map['root_url']

        odcs_fallback = {
            'api_url': self.config_kwargs.get('odcs_url'),
            'insecure': self.config_kwargs.get('odcs_insecure')
        }
        odcs_map = get_odcs(self.workflow, odcs_fallback)
        self.config_kwargs['odcs_url'] = odcs_map['api_url']
        self.config_kwargs['odcs_insecure'] = odcs_map.get('insecure', False)

        smtp_fallback = {
            'host': self.config_kwargs.get('smtp_host'),
            'from_address': self.config_kwargs.get('smtp_from'),
            'domain': self.config_kwargs.get('smtp_email_domain'),
            'send_to_submitter': self.config_kwargs.get('smtp_to_submitter'),
            'send_to_pkg_owner': self.config_kwargs.get('smtp_to_pkgowner')
        }
        additional_addresses = self.config_kwargs.get('smtp_error_addresses')
        error_addresses = self.config_kwargs.get('smtp_additional_addresses')

        smtp_fallback['additional_addresses'] =\
            additional_addresses.split(',') if additional_addresses else ()
        smtp_fallback['error_addresses'] = error_addresses.split(
            ',') if error_addresses else ()

        smtp_map = get_smtp(self.workflow, smtp_fallback)
        self.config_kwargs['smtp_additional_addresses'] =\
            ','.join(smtp_map.get('additional_addresses', ()))
        self.config_kwargs['smtp_email_domain'] = smtp_map.get('domain')
        self.config_kwargs['smtp_error_addresses'] = ','.join(
            smtp_map.get('error_addresses', ()))
        self.config_kwargs['smtp_from'] = smtp_map['from_address']
        self.config_kwargs['smtp_host'] = smtp_map['host']
        self.config_kwargs['smtp_to_pkgowner'] = smtp_map.get(
            'send_to_pkg_owner', False)
        self.config_kwargs['smtp_to_submitter'] = smtp_map.get(
            'send_to_submitter', False)

        source_reg = self.config_kwargs.get('source_registry_uri')
        souce_registry = get_source_registry(
            self.workflow,
            {'uri': RegistryURI(source_reg) if source_reg else None})['uri']
        self.config_kwargs[
            'source_registry_uri'] = souce_registry.uri if souce_registry else None

        artifacts = self.config_kwargs.get('artifacts_allowed_domains')
        self.config_kwargs['artifacts_allowed_domains'] =\
            ','.join(get_artifacts_allowed_domains(
                self.workflow, artifacts.split(',') if artifacts else ()))

        equal_labels_fallback = []
        equal_labels_str = self.config_kwargs.get('equal_labels')

        if equal_labels_str:
            label_groups = [x.strip() for x in equal_labels_str.split(',')]

            for label_group in label_groups:
                equal_labels_fallback.append(
                    [label.strip() for label in label_group.split(':')])

        equal_labels = get_image_equal_labels(self.workflow,
                                              equal_labels_fallback)
        if equal_labels:
            equal_labels_sets = []
            for equal_set in equal_labels:
                equal_labels_sets.append(':'.join(equal_set))
            equal_labels_string = ','.join(equal_labels_sets)
            self.config_kwargs['equal_labels'] = equal_labels_string

        self.config_kwargs['prefer_schema1_digest'] =\
            get_prefer_schema1_digest(self.workflow,
                                      self.config_kwargs.get('prefer_schema1_digest'))

        registry_api_ver = self.config_kwargs.get('registry_api_versions')
        self.config_kwargs['registry_api_versions'] =\
            ','.join(get_content_versions(self.workflow,
                                          registry_api_ver.split(',') if registry_api_ver else ()))

        self.config_kwargs['yum_proxy'] =\
            get_yum_proxy(self.workflow, self.config_kwargs.get('yum_proxy'))

        self.config_kwargs['sources_command'] =\
            get_sources_command(self.workflow, self.config_kwargs.get('sources_command'))
    def adjust_config_kwargs(self):
        koji_fallback = {
            'hub_url': self.config_kwargs.get('koji_hub'),
            'root_url': self.config_kwargs.get('koji_root')
        }
        koji_map = get_koji(self.workflow, koji_fallback)
        self.config_kwargs['koji_hub'] = koji_map['hub_url']
        self.config_kwargs['koji_root'] = koji_map['root_url']

        odcs_fallback = {
            'api_url': self.config_kwargs.get('odcs_url'),
            'insecure': self.config_kwargs.get('odcs_insecure')
        }
        odcs_map = get_odcs(self.workflow, odcs_fallback)
        self.config_kwargs['odcs_url'] = odcs_map['api_url']
        self.config_kwargs['odcs_insecure'] = odcs_map.get('insecure', False)

        pulp_fallback = {'name': self.config_kwargs.get('pulp_registry_name')}
        pulp_map = get_pulp(self.workflow, pulp_fallback)
        self.config_kwargs['pulp_registry_name'] = pulp_map['name']

        smtp_fallback = {
            'host': self.config_kwargs.get('smtp_host'),
            'from_address': self.config_kwargs.get('smtp_from'),
            'domain': self.config_kwargs.get('smtp_email_domain'),
            'send_to_submitter': self.config_kwargs.get('smtp_to_submitter'),
            'send_to_pkg_owner': self.config_kwargs.get('smtp_to_pkgowner')
        }
        additional_addresses = self.config_kwargs.get('smtp_error_addresses')
        error_addresses = self.config_kwargs.get('smtp_additional_addresses')

        smtp_fallback['additional_addresses'] =\
            additional_addresses.split(',') if additional_addresses else ()
        smtp_fallback['error_addresses'] = error_addresses.split(',') if error_addresses else ()

        smtp_map = get_smtp(self.workflow, smtp_fallback)
        self.config_kwargs['smtp_additional_addresses'] =\
            ','.join(smtp_map.get('additional_addresses', ()))
        self.config_kwargs['smtp_email_domain'] = smtp_map.get('domain')
        self.config_kwargs['smtp_error_addresses'] = ','.join(smtp_map.get('error_addresses', ()))
        self.config_kwargs['smtp_from'] = smtp_map['from_address']
        self.config_kwargs['smtp_host'] = smtp_map['host']
        self.config_kwargs['smtp_to_pkgowner'] = smtp_map.get('send_to_pkg_owner', False)
        self.config_kwargs['smtp_to_submitter'] = smtp_map.get('send_to_submitter', False)

        source_reg = self.config_kwargs.get('source_registry_uri')
        souce_registry = get_source_registry(self.workflow, {
            'uri': RegistryURI(source_reg) if source_reg else None})['uri']
        self.config_kwargs['source_registry_uri'] = souce_registry.uri if souce_registry else None

        artifacts = self.config_kwargs.get('artifacts_allowed_domains')
        self.config_kwargs['artifacts_allowed_domains'] =\
            ','.join(get_artifacts_allowed_domains(
                self.workflow, artifacts.split(',') if artifacts else ()))

        equal_labels_fallback = []
        equal_labels_str = self.config_kwargs.get('equal_labels')

        if equal_labels_str:
            label_groups = [x.strip() for x in equal_labels_str.split(',')]

            for label_group in label_groups:
                equal_labels_fallback.append([label.strip() for label in label_group.split(':')])

        equal_labels = get_image_equal_labels(self.workflow, equal_labels_fallback)
        if equal_labels:
            equal_labels_sets = []
            for equal_set in equal_labels:
                equal_labels_sets.append(':'.join(equal_set))
            equal_labels_string = ','.join(equal_labels_sets)
            self.config_kwargs['equal_labels'] = equal_labels_string

        self.config_kwargs['prefer_schema1_digest'] =\
            get_prefer_schema1_digest(self.workflow,
                                      self.config_kwargs.get('prefer_schema1_digest'))

        registry_api_ver = self.config_kwargs.get('registry_api_versions')
        self.config_kwargs['registry_api_versions'] =\
            ','.join(get_content_versions(self.workflow,
                                          registry_api_ver.split(',') if registry_api_ver else ()))

        self.config_kwargs['yum_proxy'] =\
            get_yum_proxy(self.workflow, self.config_kwargs.get('yum_proxy'))

        self.config_kwargs['sources_command'] =\
            get_sources_command(self.workflow, self.config_kwargs.get('sources_command'))