From dfdd924bbf99f0cb96bd8ae99a38ad8578231471 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Thu, 17 Aug 2017 14:50:09 +0200 Subject: [PATCH] Always regen repository when starting module build to not wait on kojira. --- .../scheduler/handlers/modules.py | 23 ++++++++----------- tests/test_scheduler/test_module_wait.py | 4 ++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/module_build_service/scheduler/handlers/modules.py b/module_build_service/scheduler/handlers/modules.py index 363bff67..0249be3c 100644 --- a/module_build_service/scheduler/handlers/modules.py +++ b/module_build_service/scheduler/handlers/modules.py @@ -292,16 +292,13 @@ def wait(config, session, msg): session.add(build) session.commit() - # If this build already exists and is done, then regenerate the repository - # to ensure module-build-macros is there. - if state == koji.BUILD_STATES['COMPLETE']: - if config.system == "koji": - log.info("module-build-macros is already built. " - "Regenerating the repo.") - task_id = builder.koji_session.newRepo( - builder.module_build_tag['name']) - build.new_repo_task_id = task_id - session.commit() - else: - return [module_build_service.messaging.KojiRepoChange( - 'fake msg', builder.module_build_tag['name'])] + # We always have to regenerate the repository. + if config.system == "koji": + log.info("Regenerating the repository") + task_id = builder.koji_session.newRepo( + builder.module_build_tag['name']) + build.new_repo_task_id = task_id + session.commit() + else: + return [module_build_service.messaging.KojiRepoChange( + 'fake msg', builder.module_build_tag['name'])] diff --git a/tests/test_scheduler/test_module_wait.py b/tests/test_scheduler/test_module_wait.py index 843b9dbe..a9cbca82 100644 --- a/tests/test_scheduler/test_module_wait.py +++ b/tests/test_scheduler/test_module_wait.py @@ -133,7 +133,7 @@ class TestModuleWait(unittest.TestCase): def test_new_repo_not_called_when_macros_not_reused( self, pdc, create_builder, koji_get_session, dbg): """ - Test that newRepo is not called when module-build-macros build is not reused. + Test that newRepo is called everytime for module-build-macros """ with app.app_context(): pdc.get_module_tag.return_value = "module-testmodule-master-20170109091357" @@ -153,4 +153,4 @@ class TestModuleWait(unittest.TestCase): module_build_state='some state') module_build_service.scheduler.handlers.modules.wait( config=conf, session=db.session, msg=msg) - self.assertTrue(not koji_session.newRepo.called) + self.assertTrue(koji_session.newRepo.called)