Expose buildset to the executor and url formatter

For github (and probably other providers) we really only have the option
of returning 1 url for the entire buildset, as opposed to 1 per build.
To make log uploading within that easier we really need a way to
globally identify all the different builds that belong to 1 change.

The zuul ref is already available however this is a concept that is
planned to be deprecated, so instead add a UUID parameter to the
buildset that we can pass through. This UUID is used to build the ref to
make migration easier.

Change-Id: I1cab8af5c9d7f6875591fbe4ac4e184b90f6ca12
Signed-off-by: Jamie Lennox <jamielennox@gmail.com>
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index ab304b2..636abb4 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -13,7 +13,7 @@
 # under the License.
 
 import re
-from testtools.matchers import MatchesRegex
+from testtools.matchers import MatchesRegex, StartsWith
 import time
 
 from tests.base import ZuulTestCase, simple_layout, random_sha1
@@ -300,9 +300,20 @@
         self.assertEqual('tenant-one/reporting', report_status['context'])
         self.assertEqual('success', report_status['state'])
         self.assertEqual(2, len(A.comments))
-        report_url = ('http://logs.example.com/tenant-one/reporting/'
-                      '%s/%s/%s/' % (A.project, A.number, A.head_sha))
-        self.assertEqual(report_url, report_status['url'])
+
+        base = 'http://logs.example.com/tenant-one/reporting/%s/%s/' % (
+            A.project, A.number)
+
+        # Deconstructing the URL because we don't save the BuildSet UUID
+        # anywhere to do a direct comparison and doing regexp matches on a full
+        # URL is painful.
+
+        # The first part of the URL matches the easy base string
+        self.assertThat(report_status['url'], StartsWith(base))
+
+        # The rest of the URL is a UUID and a trailing slash.
+        self.assertThat(report_status['url'][len(base):],
+                        MatchesRegex('^[a-fA-F0-9]{32}\/$'))
 
     @simple_layout('layouts/merging-github.yaml', driver='github')
     def test_report_pull_merge(self):