From daf29dd93c21bcdabe7438d35b61ea2d101ac9fa Mon Sep 17 00:00:00 2001 From: mprahl Date: Mar 03 2020 19:48:47 +0000 Subject: Move some of the defaults from conf/config.py to module_build_service/config.py This removes the need to duplicate these configuration values. --- diff --git a/conf/config.py b/conf/config.py index 1679a1b..ec83936 100644 --- a/conf/config.py +++ b/conf/config.py @@ -19,71 +19,6 @@ class BaseConfiguration(object): HOST = "0.0.0.0" PORT = 5000 - MESSAGING_TOPIC_PREFIX = ["org.fedoraproject.prod"] - KOJI_CONFIG = "/etc/module-build-service/koji.conf" - KOJI_PROFILE = "koji" - ARCHES = ["i686", "armv7hl", "x86_64"] - KOJI_REPOSITORY_URL = "https://kojipkgs.fedoraproject.org/repos" - PDC_URL = "https://pdc.fedoraproject.org/rest_api/v1" - PDC_INSECURE = False - PDC_DEVELOP = True - SCMURLS = ["https://src.fedoraproject.org/modules/"] - - # How often should we resort to polling, in seconds - # Set to zero to disable polling - POLLING_INTERVAL = 600 - - # Determines how many builds that can be submitted to the builder - # and be in the build state at a time. Set this to 0 for no restrictions - NUM_CONCURRENT_BUILDS = 5 - - RPMS_DEFAULT_REPOSITORY = "https://src.fedoraproject.org/rpms/" - RPMS_DEFAULT_CACHE = "http://pkgs.fedoraproject.org/repo/pkgs/" - - MODULES_DEFAULT_REPOSITORY = "https://src.fedoraproject.org/modules/" - - # Path to log file when LOG_BACKEND is set to "file". - LOG_FILE = "module_build_service.log" - - # Available log levels are: debug, info, warn, error. - LOG_LEVEL = "info" - - # Settings for Kerberos - KRB_KEYTAB = None - KRB_PRINCIPAL = None - - # AMQ prefixed variables are required only while using 'amq' as messaging backend - # Addresses to listen to - AMQ_RECV_ADDRESSES = [ - "amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.koji", - "amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.module_build_service", - ] - # Address for sending messages - AMQ_DEST_ADDRESS = \ - "amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.module_build_service" - AMQ_CERT_FILE = "/etc/module_build_service/msg-m8y-client.crt" - AMQ_PRIVATE_KEY_FILE = "/etc/module_build_service/msg-m8y-client.key" - AMQ_TRUSTED_CERT_FILE = "/etc/module_build_service/Root-CA.crt" - - # Configs for running tasks asynchronously with Celery - # For details of Celery configs, refer to Celery documentation: - # https://docs.celeryproject.org/en/latest/userguide/configuration.html - # - # Each config name consists of namespace CELERY_ and the new Celery config - # name converted to upper case. For example the broker url, Celery config - # name is broker_url, then as you can below, the corresponding config name - # in MBS is CELERY_BROKER_URL. - CELERY_BROKER_URL = "" - CELERY_RESULT_BACKEND = "" - CELERY_IMPORTS = [ - "module_build_service.scheduler.handlers.components", - "module_build_service.scheduler.handlers.modules", - "module_build_service.scheduler.handlers.repos", - "module_build_service.scheduler.handlers.tags", - "module_build_service.scheduler.handlers.greenwave", - "module_build_service.scheduler.producer", - ] - class TestConfiguration(BaseConfiguration): LOG_LEVEL = "debug" @@ -91,7 +26,6 @@ class TestConfiguration(BaseConfiguration): "DATABASE_URI", "sqlite:///{0}".format(path.join(dbdir, "mbstest.db"))) DEBUG = True MESSAGING = "in_memory" - PDC_URL = "https://pdc.fedoraproject.org/rest_api/v1" # Global network-related values, in seconds NET_TIMEOUT = 3 @@ -144,6 +78,3 @@ class OfflineLocalBuildConfiguration(LocalBuildConfiguration): class DevConfiguration(LocalBuildConfiguration): DEBUG = True - - CELERY_BROKER_URL = "redis://localhost:6379/0" - CELERY_RESULT_BACKEND = "redis://localhost:6379/0" diff --git a/module_build_service/config.py b/module_build_service/config.py index 6a47a3a..19866f1 100644 --- a/module_build_service/config.py +++ b/module_build_service/config.py @@ -123,7 +123,7 @@ class Config(object): "default": "module+", "desc": "Default dist-tag prefix for built modules.", }, - "polling_interval": {"type": int, "default": 0, "desc": "Polling interval, in seconds."}, + "polling_interval": {"type": int, "default": 600, "desc": "Polling interval, in seconds."}, "cache_dir": { "type": Path, "default": os.path.join(tempfile.gettempdir(), "mbs"), @@ -144,16 +144,24 @@ class Config(object): "default": "https://pdc.fedoraproject.org/rest_api/v1", "desc": "PDC URL, used for checking stream EOL.", }, - "koji_config": {"type": str, "default": None, "desc": "Koji config file."}, - "koji_profile": {"type": str, "default": None, "desc": "Koji config profile."}, - "arches": {"type": list, "default": [], "desc": "Koji architectures."}, + "koji_config": { + "type": str, + "default": "/etc/module-build-service/koji.conf", + "desc": "Koji config file." + }, + "koji_profile": {"type": str, "default": "koji", "desc": "Koji config profile."}, + "arches": {"type": list, "default": ["x86_64"], "desc": "Koji architectures."}, "allow_arch_override": { "type": bool, "default": False, "desc": "Allow to support a custom architecture set", }, "koji_build_priority": {"type": int, "default": 10, "desc": ""}, - "koji_repository_url": {"type": str, "default": None, "desc": "Koji repository URL."}, + "koji_repository_url": { + "type": str, + "default": "https://kojipkgs.fedoraproject.org/repos", + "desc": "Koji repository URL." + }, "koji_build_macros_target": { "type": str, "default": "", @@ -249,7 +257,7 @@ class Config(object): }, "log_backend": {"type": str, "default": None, "desc": "Log backend"}, "log_file": {"type": str, "default": "", "desc": "Path to log file"}, - "log_level": {"type": str, "default": 0, "desc": "Log level"}, + "log_level": {"type": str, "default": "info", "desc": "Log level"}, "build_logs_dir": { "type": Path, "default": tempfile.gettempdir(), @@ -271,31 +279,6 @@ class Config(object): "default": ["org.fedoraproject.prod"], "desc": "The messaging system topic prefixes which we are interested in.", }, - "amq_recv_addresses": { - "type": list, - "default": [], - "desc": "Apache MQ broker url to receive messages.", - }, - "amq_dest_address": { - "type": str, - "default": "", - "desc": "Apache MQ broker address to send messages", - }, - "amq_cert_file": { - "type": str, - "default": "", - "desc": "Certificate for Apache MQ broker auth.", - }, - "amq_private_key_file": { - "type": str, - "default": "", - "desc": "Private key for Apache MQ broker auth.", - }, - "amq_trusted_cert_file": { - "type": str, - "default": "", - "desc": "Trusted certificate for ssl connection.", - }, "distgits": { "type": dict, "default": { @@ -334,7 +317,11 @@ class Config(object): "default": "x86_64", "desc": "Fallback arch if auto-detection is off or unable to determine it.", }, - "scmurls": {"type": list, "default": [], "desc": "Allowed SCM URLs for submitted module."}, + "scmurls": { + "type": list, + "default": ["https://src.fedoraproject.org/modules/"], + "desc": "Allowed SCM URLs for submitted module.", + }, "yaml_submit_allowed": { "type": bool, "default": False, @@ -342,7 +329,7 @@ class Config(object): }, "num_concurrent_builds": { "type": int, - "default": 0, + "default": 5, "desc": "Number of concurrent component builds.", }, "net_timeout": { @@ -690,6 +677,23 @@ class Config(object): "handle at a time. This so that general tasks aren't starved when running " "a long handler.", }, + "celery_broker_url": { + "type": str, + "default": "", + "desc": "The broker URL used by the Celery application instance.", + }, + "celery_imports": { + "type": list, + "default": [ + "module_build_service.scheduler.handlers.components", + "module_build_service.scheduler.handlers.modules", + "module_build_service.scheduler.handlers.repos", + "module_build_service.scheduler.handlers.tags", + "module_build_service.scheduler.handlers.greenwave", + "module_build_service.scheduler.producer", + ], + "desc": "The list Python paths for the Celery application to import.", + }, } def __init__(self, conf_section_obj): diff --git a/openshift/mbs-test-template.yaml b/openshift/mbs-test-template.yaml index 238fa7b..ab42813 100644 --- a/openshift/mbs-test-template.yaml +++ b/openshift/mbs-test-template.yaml @@ -119,8 +119,6 @@ objects: KOJI_PROXYUSER = False KOJI_REPOSITORY_URL = '' PDC_URL = '' - PDC_INSECURE = True - PDC_DEVELOP = True SCMURLS = [] ALLOW_CUSTOM_SCMURLS = True @@ -551,8 +549,6 @@ objects: KOJI_PROXYUSER = False KOJI_REPOSITORY_URL = '' PDC_URL = '' - PDC_INSECURE = True - PDC_DEVELOP = True SCMURLS = [] ALLOW_CUSTOM_SCMURLS = True