From b4d712cf3366f7d5fc05aa9d86167ea0c625bc70 Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Wed, 12 Oct 2016 16:32:52 +0200 Subject: [PATCH 1/2] Instantly fail component builds if we fail to submit them - Fail builds if builder.build() does not return bool(value) == True Signed-off-by: Lubos Kocman --- rida/scheduler/handlers/modules.py | 10 +++++++++- rida/utils.py | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rida/scheduler/handlers/modules.py b/rida/scheduler/handlers/modules.py index d23f56ab..4912e46f 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 3f1cfbfb..ac368a5d 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() From 0106086836d14996cb522d40383b152f3b7ba264 Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Thu, 13 Oct 2016 15:08:49 +0200 Subject: [PATCH 2/2] separate inline comment by two spaces --- rida/scheduler/handlers/modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rida/scheduler/handlers/modules.py b/rida/scheduler/handlers/modules.py index 4912e46f..f7917a22 100644 --- a/rida/scheduler/handlers/modules.py +++ b/rida/scheduler/handlers/modules.py @@ -129,7 +129,7 @@ def wait(config, session, msg): build.batch = 1 artifact_name = "module-build-macros" - state = koji.BUILD_STATES['BUILDING'] # Default state + 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