diff --git a/module_build_service/scheduler/handlers/components.py b/module_build_service/scheduler/handlers/components.py index ac6e8825..15bde96e 100644 --- a/module_build_service/scheduler/handlers/components.py +++ b/module_build_service/scheduler/handlers/components.py @@ -98,18 +98,19 @@ def _finalize(config, session, msg, state): builder = module_build_service.builder.GenericBuilder.create_from_module( session, parent, config) - if not built_components_in_batch or failed_components_in_batch: - # If there are no successfully built components in a batch, - # there is nothing to tag. If there is some failed component build, - # we should not tag even the successfully built components, because - # the module build will fail anyway. Repository won't be - # regenerated in these cases and therefore we generate fake repo + if failed_components_in_batch: + log.info("Batch done, but not tagging because of failed component builds. Will " + "transition the module to \"failed\"") + parent.transition(config, state=models.BUILD_STATES['failed'], + state_reason="Some components failed to build.") + session.commit() + builder.finalize() + return [] + elif not built_components_in_batch: + # If there are no successfully built components in a batch, there is nothing to tag. + # The repository won't be regenerated in this case and therefore we generate fake repo # change message here. - if failed_components_in_batch: - log.info("Batch done, but not tagging because of failed " - "component builds.") - else: - log.info("Batch done. No component to tag") + log.info("Batch done. No component to tag") further_work += [messaging.KojiRepoChange( 'components::_finalize: fake msg', builder.module_build_tag['name'])] diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index 8a7d3d8a..47f1c3d3 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -658,9 +658,6 @@ class TestBuild(unittest.TestCase): FakeModuleBuilder.BUILD_STATE = "COMPLETE" # Tag the build in the -build tag cls._send_tag(artifact_name) - if not artifact_name.startswith("module-build-macros"): - # Tag the build in the final tag - cls._send_tag(artifact_name, build=False) FakeModuleBuilder.on_build_cb = on_build_cb