From a10f93b69ebca9f222776cde49e95d1fc77bc431 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Oct 13 2016 15:03:40 +0000 Subject: Merge #87 `Instantly fail component builds if we fail to submit them` --- diff --git a/rida/scheduler/handlers/modules.py b/rida/scheduler/handlers/modules.py index d23f56a..f7917a2 100644 --- a/rida/scheduler/handlers/modules.py +++ b/rida/scheduler/handlers/modules.py @@ -129,14 +129,22 @@ def wait(config, session, msg): build.batch = 1 artifact_name = "module-build-macros" + state = koji.BUILD_STATES['BUILDING'] # Default state task_id = builder.build(artifact_name=artifact_name, source=srpm) + + # Fail task if we failed to submit it to koji + # This typically happens when koji auth failed + if not task_id: + state = koji.BUILD_STATES['FAILED'] + # TODO: set fail_reason to "Failed to submit build" + component_build = models.ComponentBuild( module_id=build.id, package=artifact_name, format="rpms", scmurl=srpm, task_id=task_id, - state=koji.BUILD_STATES['BUILDING'], + state=state, batch=1, ) session.add(component_build) diff --git a/rida/utils.py b/rida/utils.py index 3f1cfbf..ac368a5 100644 --- a/rida/utils.py +++ b/rida/utils.py @@ -71,6 +71,11 @@ def start_next_build_batch(module, session, builder, components=None): for c in unbuilt_components: c.batch = module.batch c.task_id = builder.build(artifact_name=c.package, source=c.scmurl) + # Fail task if we failed to submit it to koji + # This typically happens when koji auth failed + if not c.task_id: + c.state = koji.BUILD_STATES['FAILED'] + # TODO: set c.fail_reason to "Failed to submit build" session.commit()