Skip to contentSkip to conversation

toaster: report and stop builds on git and server exceptions

PATCH New David Reyna 1 participant 1 message Sep 7, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: report and stop builds on git and server exceptions

From: David Reyna <[email protected]>

Stop the pending build and report to the user if there is an internal exception due to a git error, a bitbake server error, or if the server-only mode halts due to for example a user syntax error in a layer or recipe.

These exceptions were not caught because they occured before the normal toastergui processing was started.

[YOCTO #12056]

---
 bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | 8 ++++++++
 1 file changed, 8 insertions(+)
bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +8 -0
index 8eacb5e..791e53e 100644
@@ -79,6 +79,14 @@ class Command(BaseCommand):
             br.save()
             bec.be.lock = BuildEnvironment.LOCK_FREE
             bec.be.save()
+            # Cancel the pending build and report the exception to the UI
+            log_object = LogMessage.objects.create(
+                            build = br.build,
+                            level = LogMessage.EXCEPTION,
+                            message = errmsg)
+            log_object.save()
+            br.build.outcome = Build.FAILED
+            br.build.save()
 
     def archive(self):
         for br in BuildRequest.objects.filter(state=BuildRequest.REQ_ARCHIVE):
Signature · 1 line
1.9.1