Enable koji content generator code

If the koji_enable_content_generator is configured to True koji instance
has to be configured as follows:
koji call addBType module
koji grant-cg-access <mbs-user> module-build-service --new

Without the above configuration MBS will start failing the builds
This commit is contained in:
Stanislav Ochotnicky
2017-05-24 20:38:57 +02:00
parent 56d9312aa1
commit b33beb0cef
3 changed files with 12 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ class BaseConfiguration(object):
KOJI_PROXYUSER = True
KOJI_REPOSITORY_URL = 'https://kojipkgs.fedoraproject.org/repos'
KOJI_TAG_PREFIXES = ['module']
KOJI_ENABLE_CONTENT_GENERATOR = True
COPR_CONFIG = '/etc/module-build-service/copr.conf'
PDC_URL = 'http://pdc.fedoraproject.org/rest_api/v1'
PDC_INSECURE = True

View File

@@ -186,6 +186,11 @@ class Config(object):
'default': 24*3600,
'desc': 'Time in seconds after which the Koji target of '
'built module is deleted'},
'koji_enable_content_generator': {
'type': bool,
'default': True,
'desc': 'Enable or disable imports to koji using content '
'generator api'},
'allow_custom_scmurls': {
'type': bool,
'default': False,

View File

@@ -30,6 +30,7 @@ import module_build_service.utils
import module_build_service.messaging
from module_build_service.utils import (
start_next_batch_build, attempt_to_reuse_all_components)
from module_build_service.builder.KojiContentGenerator import KojiContentGenerator
from requests.exceptions import ConnectionError
@@ -120,6 +121,11 @@ def done(config, session, msg):
# This is ok.. it's a race condition we can ignore.
pass
if config.system == 'koji' and config.koji_enable_content_generator:
# KojiContentGenerator import
cg = KojiContentGenerator(build, config)
cg.koji_import()
build.transition(config, state="ready")
session.commit()