mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 02:11:19 +08:00
Pass the module build into builder
This commit is contained in:
@@ -60,7 +60,8 @@ class CoprModuleBuilder(GenericBuilder):
|
||||
self.owner = owner
|
||||
self.config = config
|
||||
self.tag_name = tag_name
|
||||
self.module_str = module
|
||||
self.module = module
|
||||
self.module_str = module.name
|
||||
|
||||
self.copr = None
|
||||
self.client = CoprModuleBuilder._get_client(config)
|
||||
|
||||
@@ -61,12 +61,12 @@ class KojiModuleBuilder(GenericBuilder):
|
||||
def __init__(self, owner, module, config, tag_name, components):
|
||||
"""
|
||||
:param owner: a string representing who kicked off the builds
|
||||
:param module: string representing module
|
||||
:param module: module_build_service.models.ModuleBuild instance.
|
||||
:param config: module_build_service.config.Config instance
|
||||
:param tag_name: name of tag for given module
|
||||
"""
|
||||
self.owner = owner
|
||||
self.module_str = module
|
||||
self.module_str = module.name
|
||||
self.config = config
|
||||
self.tag_name = tag_name
|
||||
self.__prep = False
|
||||
|
||||
@@ -94,7 +94,7 @@ mdpolicy=group:primary
|
||||
|
||||
@module_build_service.utils.validate_koji_tag('tag_name')
|
||||
def __init__(self, owner, module, config, tag_name, components):
|
||||
self.module_str = module
|
||||
self.module_str = module.name
|
||||
self.tag_name = tag_name
|
||||
self.config = config
|
||||
self.groups = []
|
||||
|
||||
@@ -100,7 +100,7 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
|
||||
def create(cls, owner, module, backend, config, **extra):
|
||||
"""
|
||||
:param owner: a string representing who kicked off the builds
|
||||
:param module: a module string e.g. 'testmodule-1.0'
|
||||
:param module: module_build_service.models.ModuleBuild instance.
|
||||
:param backend: a string representing backend e.g. 'koji'
|
||||
:param config: instance of module_build_service.config.Config
|
||||
|
||||
@@ -125,7 +125,7 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
|
||||
"""
|
||||
components = [c.package for c in module.component_builds]
|
||||
builder = GenericBuilder.create(
|
||||
module.owner, module.name, config.system, config,
|
||||
module.owner, module, config.system, config,
|
||||
tag_name=module.koji_tag, components=components)
|
||||
groups = GenericBuilder.default_buildroot_groups(session, module)
|
||||
builder.buildroot_connect(groups)
|
||||
|
||||
@@ -81,7 +81,7 @@ def failed(config, session, msg):
|
||||
|
||||
if build.koji_tag:
|
||||
builder = module_build_service.builder.GenericBuilder.create(
|
||||
build.owner, build.name, config.system, config, tag_name=build.koji_tag,
|
||||
build.owner, build, config.system, config, tag_name=build.koji_tag,
|
||||
components=[c.package for c in build.component_builds])
|
||||
builder.buildroot_connect(groups)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ def done(config, session, msg):
|
||||
session, module_build)
|
||||
|
||||
builder = module_build_service.builder.GenericBuilder.create(
|
||||
module_build.owner, module_build.name, config.system, config,
|
||||
module_build.owner, module_build, config.system, config,
|
||||
tag_name=tag, components=[c.package for c in module_build.component_builds])
|
||||
builder.buildroot_connect(groups)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import munch
|
||||
import mock
|
||||
import koji
|
||||
import xmlrpclib
|
||||
from collections import namedtuple
|
||||
|
||||
import module_build_service.messaging
|
||||
import module_build_service.scheduler.handlers.repos
|
||||
@@ -58,6 +59,10 @@ class FakeKojiModuleBuilder(KojiModuleBuilder):
|
||||
|
||||
return koji_session
|
||||
|
||||
|
||||
ModuleBuildMock = namedtuple('ModuleBuildMock', ['name'])
|
||||
|
||||
|
||||
class TestKojiBuilder(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -83,7 +88,7 @@ class TestKojiBuilder(unittest.TestCase):
|
||||
'checkForBuilds.side_effect': IOError}
|
||||
mocked_kojiutil.configure_mock(**attrs)
|
||||
fake_kmb = FakeKojiModuleBuilder(owner='Moe Szyslak',
|
||||
module='nginx',
|
||||
module=ModuleBuildMock(name='nginx'),
|
||||
config=conf,
|
||||
tag_name='module-nginx-1.2',
|
||||
components=[])
|
||||
@@ -99,7 +104,7 @@ class TestKojiBuilder(unittest.TestCase):
|
||||
tag already tagged artifacts
|
||||
"""
|
||||
builder = FakeKojiModuleBuilder(owner='Moe Szyslak',
|
||||
module='nginx',
|
||||
module=ModuleBuildMock(name='nginx'),
|
||||
config=conf,
|
||||
tag_name='module-nginx-1.2',
|
||||
components=[])
|
||||
@@ -134,7 +139,7 @@ class TestGetKojiClientSession(unittest.TestCase):
|
||||
self.config.koji_profile = conf.koji_profile
|
||||
self.config.koji_config = conf.koji_config
|
||||
self.owner = 'Matt Jia'
|
||||
self.module = 'fool'
|
||||
self.module = ModuleBuildMock(name='fool')
|
||||
self.tag_name = 'module-fool-1.2'
|
||||
|
||||
@patch.object(koji.ClientSession, 'krb_login')
|
||||
|
||||
Reference in New Issue
Block a user