Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.

Commit

Permalink
Lookup full revision for try builds (#111)
Browse files Browse the repository at this point in the history
|mozdownload| now requires the full length revision when requesting a
try build. TryBuilder is updated to look that up if a short revision is
provided. Additionally the 12 character limit is removed when requesting
a try build. Tests have been updated for both styles.
  • Loading branch information
EricRahm committed Jan 19, 2016
1 parent 58a8694 commit 1f0ed5c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 11 deletions.
4 changes: 4 additions & 0 deletions benchtester/BuildGetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ class TryBuild(DownloadedBuild):
"""A try build from ftp.m.o. Initialized with a 12-digit try changeset."""

def __init__(self, changeset, *args, **kwargs):
# mozdownload requires the full revision, look it up if necessary.
if len(changeset) != 40:
(changeset, _) = pushlog_lookup(changeset, branch='try', base_url=kwargs.get('base_hg_url', BASE_HG_URL))

self._changeset = changeset
scraper_info = {
'type': mozdownload.scraper.TryScraper,
Expand Down
4 changes: 2 additions & 2 deletions html/status/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ $(function () {
alert("The try changeset ID should only contain a-f, 0-9");
return false;
}
if (start.length != 12) {
alert("The try changeset ID must be exactly 12 characters");
if (start.length < 12) {
alert("The try changeset ID must be at least 12 characters");
return false;
}

Expand Down
28 changes: 24 additions & 4 deletions tests/benchtester/test_build_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,35 @@ def test_try(self):
TryBuild(directory=self.temp_dir,
base_ftp_url=self.wdir,
base_hg_url=self.hgdir,
changeset="98567ca569b")
changeset="a7d50e410ced2f0335bab09c7cc65ff2d2733b97")

self.assertTrue(try_build.get_valid())

try_build.prepare()

binary = try_build.get_binary()
self.assertTrue(os.path.exists(binary))
self.assertEqual(try_build.get_revision(), "798567ca569b")
self.assertEqual(try_build.get_revision(), "a7d50e410ced2f0335bab09c7cc65ff2d2733b97")
self.assertEqual(try_build.get_buildtime(), 1422654729)

try_build.cleanup()

self.assertFalse(os.path.exists(binary))

def test_try_short(self):
try_build = \
TryBuild(directory=self.temp_dir,
base_ftp_url=self.wdir,
base_hg_url=self.hgdir,
changeset="a7d50e410ced")

self.assertTrue(try_build.get_valid())

try_build.prepare()

binary = try_build.get_binary()
self.assertTrue(os.path.exists(binary))
self.assertEqual(try_build.get_revision(), "a7d50e410ced2f0335bab09c7cc65ff2d2733b97")
self.assertEqual(try_build.get_buildtime(), 1422654729)

try_build.cleanup()
Expand All @@ -120,7 +140,7 @@ def test_ftp(self):
FTPBuild(directory=self.temp_dir,
base_ftp_url=self.wdir,
base_hg_url=self.hgdir,
path="%s/firefox/try-builds/erahm@mozilla.com-98567ca569b/"
path="%s/firefox/try-builds/erahm@mozilla.com-a7d50e410ced2f0335bab09c7cc65ff2d2733b97/"
"try-linux64/firefox-38.0a1.en-US.linux-x86_64.tar.bz2" % self.wdir)

self.assertTrue(ftp_build.get_valid())
Expand All @@ -129,7 +149,7 @@ def test_ftp(self):

binary = ftp_build.get_binary()
self.assertTrue(os.path.exists(binary))
self.assertEqual(ftp_build.get_revision(), "798567ca569b")
self.assertEqual(ftp_build.get_revision(), "a7d50e410ced2f0335bab09c7cc65ff2d2733b97")
self.assertEqual(ftp_build.get_buildtime(), 1422654729)

ftp_build.cleanup()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
20150126212651
https://hg.mozilla.org/try/rev/a7d50e410ced2f0335bab09c7cc65ff2d2733b97
6 changes: 5 additions & 1 deletion tests/mozhttpd_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
HERE = os.path.dirname(os.path.abspath(__file__))


SHORT_CHANGESET_MAPPING = {
"a7d50e410ced": "a7d50e410ced2f0335bab09c7cc65ff2d2733b97",
}

@mozhttpd.handlers.json_response
def resource_get(request, path):
changeset = request.query.split("=")[1]

# TODO(ER): Create a better response, this is good enough for now
return (200, {
"1234": {
"changesets": [ changeset, "..." ],
"changesets": [ SHORT_CHANGESET_MAPPING.get(changeset, changeset), "..." ],
"date": 1422654729,
"user": "erahm@mozilla.com"
}
Expand Down
4 changes: 2 additions & 2 deletions util/try_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def queue_try_job(rev, series):
"""
params = {
'mode': 'try',
'startbuild': rev[:12],
'startbuild': rev,
'series': series,
'prioritize': True
}
Expand All @@ -139,7 +139,7 @@ def write_try_job(rev, series, batch_dir):
"""Writes the try job to the given directory"""
params = {
'mode': 'try',
'firstbuild': rev[:12],
'firstbuild': rev,
'series': series,
'prioritize': True
}
Expand Down

0 comments on commit 1f0ed5c

Please sign in to comment.