Add option to include job name in report

This can be used to create more sophisticated commentLinks in
Gerrit.

Change-Id: I74702fd7d37358e6f4caa7e7ac0a3ede73184077
diff --git a/doc/source/zuul.rst b/doc/source/zuul.rst
index 715ba39..d1cbbc5 100644
--- a/doc/source/zuul.rst
+++ b/doc/source/zuul.rst
@@ -133,6 +133,12 @@
   URLs for those links should be.
   ``http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}``
 
+**job_name_in_report**
+  Boolean value (``true`` or ``false``) that indicates whether the
+  job name should be included in the report (normally only the URL
+  is included).  Defaults to ``false``.
+  ``job_name_in_report=true``
+
 layout.yaml
 ~~~~~~~~~~~
 
diff --git a/tests/fixtures/zuul.conf b/tests/fixtures/zuul.conf
index 7c61de1..57eca51 100644
--- a/tests/fixtures/zuul.conf
+++ b/tests/fixtures/zuul.conf
@@ -13,3 +13,4 @@
 git_user_name=zuul
 push_change_refs=true
 url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
+job_name_in_report=true
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index faa10f5..ca084ac 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -1137,7 +1137,14 @@
                         elapsed = ' in %ds' % (s)
                 else:
                     elapsed = ''
-                ret += '- %s : %s%s%s\n' % (url, result, elapsed, voting)
+                if self.sched.config.has_option('zuul', 'job_name_in_report'):
+                    if self.sched.config.getboolean('zuul',
+                                                    'job_name_in_report'):
+                        name = job.name + ' '
+                else:
+                    name = ''
+                ret += '- %s%s : %s%s%s\n' % (name, url, result, elapsed,
+                                              voting)
         return ret
 
     def formatDescription(self, build):