dist_templates_builds_messages_DATA = \
src/templates/builds/messages/comment.txt \
src/templates/builds/messages/failed.txt \
- src/templates/builds/messages/finished.txt
+ src/templates/builds/messages/finished.txt \
+ src/templates/builds/messages/test-builds-failed.txt
templates_builds_messagesdir = $(templates_buildsdir)/messages
test_builds = lazy_property(get_test_builds, set_test_builds)
+ async def _test_builds_finished(self, success):
+ """
+ Called when all test builds have finished
+ """
+ # Send an email on fail
+ if not success:
+ self._send_email("builds/messages/test-builds-failed.txt",
+ build=self, test_builds=self.test_builds)
+
class Groups(base.Object):
"""
# Mark as finished
self._set_attribute_now("finished_at")
- # XXX call the build that that has created this group for test builds
+ # Call the build that has created this test group
+ if self.tested_build:
+ await self.tested_build._test_builds_finished(success=not self.has_failed())
async def failed(self):
"""
--- /dev/null
+To: {{ recipient.email_to }}
+Subject: [{{ build }}] {{ _("Test Builds Failed") }}
+Message-Id: <build-{{ build.uuid }}-tests-failed@pakfire.ipfire.org>
+In-Reply-To: <build-{{ build.uuid }}-finished@pakfire.ipfire.org>
+References: <build-{{ build.uuid }}-finished@pakfire.ipfire.org>
+
+{{ _("Hello %s,") % recipient }}
+
+{{ _("This is an automated email to let you know that the automated test build for your build has failed:",
+ "This is an automated email to let you know that the automated test builds for your build have failed:",
+ len(test_builds)) }}
+
+ /builds/{{ build.uuid }}
+
+{{ _("Test Builds") }}:
+
+{% for t in test_builds %}
+ * {% if t.is_successful() %}SUCCESS{% elif t.has_failed() %}FAILED {% end %} {{ t }}{% end %}
+
+{{ _("Sincerely,") }}
+-{{ _("The Pakfire Build Service") }}