mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-13 01:54:59 +08:00
Do not tag built components if there is any failed one.
This commit is contained in:
@@ -84,6 +84,12 @@ def _finalize(config, session, msg, state):
|
||||
if c.state == koji.BUILD_STATES['BUILDING'] or not c.state
|
||||
]
|
||||
if not unbuilt_components_in_batch:
|
||||
failed_components_in_batch = [
|
||||
c.nvr for c in parent.current_batch()
|
||||
if (c.state in [koji.BUILD_STATES['FAILED'],
|
||||
koji.BUILD_STATES['CANCELED']])
|
||||
]
|
||||
|
||||
built_components_in_batch = [
|
||||
c.nvr for c in parent.current_batch()
|
||||
if c.state == koji.BUILD_STATES['COMPLETE']
|
||||
@@ -92,11 +98,18 @@ def _finalize(config, session, msg, state):
|
||||
builder = module_build_service.builder.GenericBuilder.create_from_module(
|
||||
session, parent, config)
|
||||
|
||||
if not built_components_in_batch:
|
||||
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 and therefore the repository won't
|
||||
# be regenerated. We generate fake repo change message here.
|
||||
log.info("Batch done. No component to tag")
|
||||
# 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
|
||||
# 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")
|
||||
further_work += [messaging.KojiRepoChange(
|
||||
'components::_finalize: fake msg',
|
||||
builder.module_build_tag['name'])]
|
||||
|
||||
@@ -558,6 +558,12 @@ class TestBuild(unittest.TestCase):
|
||||
|
||||
TestModuleBuilder.on_build_cb = on_build_cb
|
||||
|
||||
# Check that no components are tagged when single component fails
|
||||
# in batch.
|
||||
def on_tag_artifacts_cb(cls, artifacts):
|
||||
raise ValueError("No component should be tagged.")
|
||||
TestModuleBuilder.on_tag_artifacts_cb = on_tag_artifacts_cb
|
||||
|
||||
msgs = []
|
||||
stop = module_build_service.scheduler.make_simple_stop_condition(db.session)
|
||||
module_build_service.scheduler.main(msgs, stop)
|
||||
|
||||
Reference in New Issue
Block a user