# Notify the owner
if self.build.owner:
- self.build.owner.send_email("jobs/messages/failed.txt", job=self)
+ # Tail the log
+ log = await self.tail_log(100)
+
+ # Send an email
+ self.build.owner.send_email(
+ "jobs/messages/failed.txt", job=self, build=self.build, log=log,
+ )
# Propagate any changes to the build
await self.build._job_finished(job=self)
To: {{ recipient.email_to }}
Subject: [{{ job.name }}] {{ _("Build Job Failed") }}
-{{ _("The build job %s has failed") % job.name }}.
-{{ _("This could have a couple of reasons and needs to be investigated by you.") }}
+{{ _("Hello %s,") % recipient }}
-{{ _("Here is more information about the incident:") }}
+{{ _("This is an automated email to let you know that this build job has failed:") }}
-* {{ _("Name") }}: {{ job.name }}
-{% if job.builder %}* {{ _("Builder") }}: {{ job.builder }}{% end %}
+ /builds/{{ build.uuid }}
-{{ _("Click on this link to get all details about the build:") }}
- {{ baseurl }}/job/{{ job.uuid }}
+{% if log %}
+{{ _("Below, you will find an excerpt of the log, which might be helpful looking for the problem.") }}
+{% end %}
{{ _("Sincerely,") }}
-{{ _("The Pakfire Build Service") }}
+
+{# Show the log if we have one #}
+{% if log %}
+ ---- {{ _("The last line of the log", "The last %(n)s lines of the log", len(log)) % { "n" : len(log) } }} ----
+
+{% for line in log %}{{ line }}{% end %}
+{% end %}