Bug 1306723 - Make non-mozharness jobs in builds-4hr use 40 character SHA revision, r=nthomas
authoraleth <aleth@instantbird.org>
Tue, 08 Nov 2016 09:34:35 +1300 (2016-11-07)
changeset 5036 46bf43f4514d07ff88071002debca576e2a34f08
parent 5031 535cc893932bfa3f0bf04ccf52b8ff5d9011c79f
child 5037 cbe5e57f6cad9ba5febfa24637e6217f953d64f6
child 5042 d785c15124a55c6cf1ef21b4846c223de0769ae4
push id4250
push usernthomas@mozilla.com
push dateMon, 07 Nov 2016 20:37:23 +0000 (2016-11-07)
reviewersnthomas
bugs1306723
Bug 1306723 - Make non-mozharness jobs in builds-4hr use 40 character SHA revision, r=nthomas
bin/try_mailer.py
misc_scheduler.py
process/factory.py
status/generators.py
--- a/bin/try_mailer.py
+++ b/bin/try_mailer.py
@@ -66,19 +66,19 @@ def makeTryMessage(build, log_url):
             who = users[0]
         else:
             print "I don't know who did this build, not sending mail"
             return None
 
     tree = props['branch']
 
     if 'got_revision' in props:
-        revision = props['got_revision'][:12]
+        revision = props['got_revision']
     elif 'revision' in props:
-        revision = props['revision'][:12]
+        revision = props['revision']
     else:
         revision = 'unknown'
 
     if 'test' in builder:
         task = 'test'
     else:
         task = 'build'
 
--- a/misc_scheduler.py
+++ b/misc_scheduler.py
@@ -204,16 +204,17 @@ def lastGoodRev(db, t, branch, builderNa
             log.msg("lastGood: ss %s good for everyone!" % (key,))
             log.msg("lastGood: looked at %i builds" % count)
             return revision
     return None
 
 
 def getLatestRev(db, t, branch, revs):
     """Returns whichever of revs has the latest when_timestamp"""
+    # Retain short revs here as these are queries to a database
     # Strip out duplicates
     short_revs = set(r[:12] for r in revs)
     if len(short_revs) == 1:
         return list(revs)[0]
 
     if 'sqlite' in db._spec.dbapiName:
         rev_clause = " OR ".join(["revision LIKE (? || '%')"] * len(short_revs))
     else:
--- a/process/factory.py
+++ b/process/factory.py
@@ -225,23 +225,16 @@ def parse_make_upload(rc, stdout, stderr
             pass
         elif m.find('cppunit') >= 0:
             pass
         else:
             retval['packageUrl'] = m
     return retval
 
 
-def short_hash(rc, stdout, stderr):
-    ''' This function takes an hg changeset id and returns just the first 12 chars'''
-    retval = {}
-    retval['got_revision'] = stdout[:12]
-    return retval
-
-
 def get_signing_cmd(signingServers, python):
     if not python:
         python = 'python'
     cmd = [
         python,
         '%(toolsdir)s/release/signing/signtool.py',
         '--cachedir', '%(basedir)s/signing_cache',
         '-t', '%(basedir)s/token',
@@ -1193,17 +1186,17 @@ class MercurialBuildFactory(MozillaBuild
                 workdir='.'
             ))
 
             self.addStep(self.makeHgtoolStep(wc='build', workdir='.'))
 
             self.addStep(SetProperty(
                 name='set_got_revision',
                 command=['hg', 'parent', '--template={node}'],
-                extract_fn=short_hash
+                property='got_revision'
             ))
         else:
             self.addStep(Mercurial(
                          name='hg_update',
                          mode='update',
                          baseURL='https://%s/' % self.hgHost,
                          defaultBranch=self.repoPath,
                          timeout=60 * 60,  # 1 hour
@@ -1785,17 +1778,17 @@ class TryBuildFactory(MercurialBuildFact
             self.addStep(ShellCommand(
                          name='hg_update',
                          command=['hg', 'up', '-C', '-r', self.buildRevision],
                          haltOnFailure=True
                          ))
         self.addStep(SetProperty(
                      name='set_got_revision',
                      command=['hg', 'parent', '--template={node}'],
-                     extract_fn=short_hash
+                     property='got_revision'
                      ))
         self.addStep(SetBuildProperty(
             name='set_comments',
             property_name="comments",
             value=lambda build: build.source.changes[-
                                                      1].comments if len(
                                                          build.source.changes) > 0 else "",
         ))
--- a/status/generators.py
+++ b/status/generators.py
@@ -1,40 +1,39 @@
 import re
 
 
 def buildTryChangeMessage(change, packageDir):
     got_revision = revision = change.revision
-    short_revision = revision[:12]
     who = change.who
     tree = change.branch
     packageDir = packageDir % locals()
     msgdict = {"type": "plain"}
-    msgdict['subject'] = "%(tree)s submission %(short_revision)s" % locals()
+    msgdict['subject'] = "%(tree)s submission %(revision)s" % locals()
     msgdict['headers'] = {"In-Reply-To": "<%(tree)s-%(revision)s>" % locals(),
                           "References": "<%(tree)s-%(revision)s>" % locals(),
                           }
     msgdict["body"] = """\
 Thank you for your try submission. It's the best!
 
 Results will be displayed on Treeherder as they come in:
-https://treeherder.mozilla.org/#/jobs?repo=%(tree)s&revision=%(short_revision)s
+https://treeherder.mozilla.org/#/jobs?repo=%(tree)s&revision=%(revision)s
 """ % locals()
 
     commitTitles = change.properties.getProperty('commit_titles')
     if commitTitles:
         title = getSensibleCommitTitle(commitTitles)
         allTitles = '\n  * '.join(commitTitles)
 
         if ((' -t ' in allTitles or ' --talos ' in allTitles) and
             '-t none' not in allTitles and '--talos none' not in allTitles):
             msgdict['body'] += """\
 
 It looks like this submission has talos jobs. You can compare the performance of your push against a baseline revision here:
-https://treeherder.mozilla.org/perf.html#/comparechooser?newProject=try&newRevision=%(short_revision)s
+https://treeherder.mozilla.org/perf.html#/comparechooser?newProject=try&newRevision=%(revision)s
 """ % locals()
 
         msgdict['subject'] += ': %(title)s' % locals()
         msgdict['body'] += """\
 
 Once completed, builds and logs will be available at:
 %(packageDir)s