Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 783585 Improve latest-build downloader and handle build errors in…

… smoketest.sh. r=wlach
  • Loading branch information...
commit 56f5c82d8e1d298f284a7d24a600180ee9da66bf 1 parent d95f25e
@markrcote markrcote authored
Showing with 25 additions and 11 deletions.
  1. +9 −5 builds.py
  2. +7 −1 smoketest.sh
  3. +9 −5 trigger_runs.py
View
14 builds.py
@@ -116,18 +116,20 @@ def branch(cls, s):
return None
def find_latest_build(self, branch_name='nightly'):
- # This assumes at least one build has been created in the last 24
- # hours.
+ window = datetime.timedelta(days=3)
now = datetime.datetime.now()
- builds = self.find_builds(now - datetime.timedelta(days=1), now,
- branch_name)
+ builds = self.find_builds(now - window, now, branch_name)
+ if not builds:
+ logging.error('Could not find any nightly builds in the last '
+ '%d days!' % window.days)
+ return None
builds.sort()
return builds[-1]
def find_builds(self, start_time, end_time, branch_name='nightly'):
branch = self.branch(branch_name)
if not branch:
- logging.error('unsupport branch "%s"' % branch_name)
+ logging.error('unsupported branch "%s"' % branch_name)
return []
if not start_time.tzinfo:
@@ -165,6 +167,8 @@ def find_builds(self, start_time, end_time, branch_name='nightly'):
if fennecregex.match(filename):
fileurl = url.scheme + '://' + url.netloc + newpath + "/" + filename
builds.append(fileurl)
+ if not builds:
+ logging.error('No builds found.')
return builds
def build_date(self, url):
View
8 smoketest.sh
@@ -46,7 +46,13 @@ fi
echo Triggering run...
python trigger_runs.py latest
-echo Waiting for result...
+if [ $? -ne 0 ]
+then
+ echo 'Could not find a suitable build!'
+ exit 1
+fi
+
+echo 'Waiting for result...'
i=0
while [ $i -le 60 ]
do
View
14 trigger_runs.py
@@ -23,8 +23,10 @@ def from_iso_date_or_datetime(s):
def main(args, options):
logging.info('Looking for builds...')
if args[0] == 'latest':
- commands = ['triggerjobs %s' %
- builds.BuildCache().find_latest_build(options.branch)]
+ build = builds.BuildCache().find_latest_build(options.branch)
+ if not build:
+ return 1
+ commands = ['triggerjobs %s' % build]
else:
if re.match('\d{14}', args[0]):
# build id
@@ -41,9 +43,11 @@ def main(args, options):
start_time = start_time.replace(tzinfo=pytz.timezone('US/Pacific'))
if not end_time.tzinfo:
end_time = end_time.replace(tzinfo=pytz.timezone('US/Pacific'))
- commands = ['triggerjobs %s' % url for url in
- builds.BuildCache().find_builds(start_time, end_time,
- options.branch)]
+ build_list = builds.BuildCache().find_builds(start_time, end_time,
+ options.branch)
+ if not build_list:
+ return 1
+ commands = ['triggerjobs %s' % url for url in build_list]
logging.info('Connecting to autophone server...')
commands.append('exit')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Please sign in to comment.
Something went wrong with that request. Please try again.