Use hotlink instead log url in github job report

This change make the job name in the job report comments of github
driver as a hotlink to instead of using a log url directly. This can
make the report comments more brief.

Change-Id: I19fb8ffbc153230b7f8eedfcd5ac15ec81a66c72
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index ebb5e1c..e404451 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -50,6 +50,12 @@
         self.assertEqual(str(A.head_sha), zuulvars['patchset'])
         self.assertEqual('master', zuulvars['branch'])
         self.assertEqual(1, len(A.comments))
+        self.assertThat(
+            A.comments[0],
+            MatchesRegex('.*\[project-test1 \]\(.*\).*', re.DOTALL))
+        self.assertThat(
+            A.comments[0],
+            MatchesRegex('.*\[project-test2 \]\(.*\).*', re.DOTALL))
         self.assertEqual(2, len(self.history))
 
         # test_pull_unmatched_branch_event(self):
diff --git a/zuul/driver/github/githubreporter.py b/zuul/driver/github/githubreporter.py
index 505757f..848ae1b 100644
--- a/zuul/driver/github/githubreporter.py
+++ b/zuul/driver/github/githubreporter.py
@@ -75,6 +75,14 @@
                     msg = self._formatItemReportMergeFailure(item)
                     self.addPullComment(item, msg)
 
+    def _formatItemReportJobs(self, item):
+        # Return the list of jobs portion of the report
+        ret = ''
+        jobs_fields = self._getItemReportJobsFields(item)
+        for job_fields in jobs_fields:
+            ret += '- [%s](%s) : %s%s%s%s\n' % job_fields
+        return ret
+
     def addPullComment(self, item, comment=None):
         message = comment or self._formatItemReport(item)
         project = item.change.project.name
diff --git a/zuul/reporter/__init__.py b/zuul/reporter/__init__.py
index ecf8855..1bff5cb 100644
--- a/zuul/reporter/__init__.py
+++ b/zuul/reporter/__init__.py
@@ -109,12 +109,10 @@
         else:
             return self._formatItemReport(item)
 
-    def _formatItemReportJobs(self, item):
-        # Return the list of jobs portion of the report
-        ret = ''
-
+    def _getItemReportJobsFields(self, item):
+        # Extract the report elements from an item
         config = self.connection.sched.config
-
+        jobs_fields = []
         for job in item.getJobs():
             build = item.current_build_set.getBuild(job.name)
             (result, url) = item.formatJobResult(job)
@@ -147,6 +145,13 @@
             else:
                 error = ''
             name = job.name + ' '
-            ret += '- %s%s : %s%s%s%s\n' % (name, url, result, error,
-                                            elapsed, voting)
+            jobs_fields.append((name, url, result, error, elapsed, voting))
+        return jobs_fields
+
+    def _formatItemReportJobs(self, item):
+        # Return the list of jobs portion of the report
+        ret = ''
+        jobs_fields = self._getItemReportJobsFields(item)
+        for job_fields in jobs_fields:
+            ret += '- %s%s : %s%s%s%s\n' % job_fields
         return ret