From 3f17e3d5880b0b8cd328b08b0e793783264e125a Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 13 Apr 2017 13:46:10 -0700 Subject: [toolchain-utils] Workaround for new bug in cbuildbot. There's a regression/bug in the cbuildbot stuff that is causing all of our cbuildbot jobs to be unable to find their build records, which causes them to fail. Adding the flag '--do-not-use-buildbucket' is a workaround that temporarily fixes this problem. This CL adds that flag to all of our cbuildbot jobs. BUG=chromium:711430 TEST=Launched cbuildbots with & without this flag; saw the problem without the flag; with the flag the problme was gone. Change-Id: I75219dad55e762ce2d5f0e3b6d885a8e91be014e Reviewed-on: https://chromium-review.googlesource.com/477391 Commit-Ready: Caroline Tice Tested-by: Caroline Tice Reviewed-by: Yunlian Jiang --- cros_utils/buildbot_utils.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'cros_utils/buildbot_utils.py') diff --git a/cros_utils/buildbot_utils.py b/cros_utils/buildbot_utils.py index d1403557..00010523 100644 --- a/cros_utils/buildbot_utils.py +++ b/cros_utils/buildbot_utils.py @@ -236,11 +236,10 @@ def GetTrybotImage(chromeos_root, command_prefix = '' if not patch_arg: command_prefix = 'yes | ' - command = ('%s ./cbuildbot --remote --nochromesdk %s' - ' --remote-description=%s %s %s %s' % (command_prefix, - optional_flags, description, - toolchain_flags, patch_arg, - build)) + command = ('%s ./cbuildbot --remote --nochromesdk --do-not-use-buildbucket %s' + ' --remote-description=%s %s %s %s' % + (command_prefix, optional_flags, description, toolchain_flags, + patch_arg, build)) _, out, _ = ce.RunCommandWOutput(command) if 'Tryjob submitted!' not in out: logger.GetLogger().LogFatal('Error occurred while launching trybot job: ' @@ -269,8 +268,8 @@ def GetTrybotImage(chromeos_root, build_info = GetBuildInfo(base_dir, build) if not build_info: if pending_time > TIME_OUT: - logger.GetLogger().LogFatal('Unable to get build logs for target %s.' % - build) + logger.GetLogger().LogFatal( + 'Unable to get build logs for target %s.' % build) else: pending_message = 'Unable to find build log; job may be pending.' done = False @@ -317,8 +316,8 @@ def GetTrybotImage(chromeos_root, (pending_time / 60)) pending_time += SLEEP_TIME else: - logger.GetLogger().LogOutput('{0} minutes passed.'.format(running_time / - 60)) + logger.GetLogger().LogOutput( + '{0} minutes passed.'.format(running_time / 60)) logger.GetLogger().LogOutput('Sleeping {0} seconds.'.format(SLEEP_TIME)) running_time += SLEEP_TIME @@ -340,8 +339,8 @@ def GetTrybotImage(chromeos_root, trybot_image = FindArchiveImage(chromeos_root, build, build_id) if not trybot_image: logger.GetLogger().LogError('Trybot job %s failed with status %d;' - ' no trybot image generated.' % - (description, build_status)) + ' no trybot image generated.' % (description, + build_status)) logger.GetLogger().LogOutput("trybot_image is '%s'" % trybot_image) logger.GetLogger().LogOutput('build_status is %d' % build_status) @@ -375,8 +374,8 @@ def WaitForImage(chromeos_root, build): while elapsed_time < TIME_OUT: if DoesImageExist(chromeos_root, build): return - logger.GetLogger().LogOutput('Image %s not ready, waiting for 10 minutes' % - build) + logger.GetLogger().LogOutput( + 'Image %s not ready, waiting for 10 minutes' % build) time.sleep(SLEEP_TIME) elapsed_time += SLEEP_TIME -- cgit v1.2.3 From 466c45d752af98dae774ecd85c1b07349c292cd9 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Fri, 14 Apr 2017 10:16:14 -0700 Subject: [toolchain-utils] Remove --do-not-use-buildbucket flag This implements the correct way to find the remote description so that we do not need to disable the buildbucket authentication. BUG=chromium:711430 TEST=Launched nightly buildbot job and it was able to find correct build log. Change-Id: I0a2e16ec284bae46af684daf3abcbbea1b9c3fe9 Reviewed-on: https://chromium-review.googlesource.com/478010 Commit-Ready: Caroline Tice Tested-by: Caroline Tice Reviewed-by: Yunlian Jiang --- cros_utils/buildbot_utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cros_utils/buildbot_utils.py') diff --git a/cros_utils/buildbot_utils.py b/cros_utils/buildbot_utils.py index 00010523..d24ba0d3 100644 --- a/cros_utils/buildbot_utils.py +++ b/cros_utils/buildbot_utils.py @@ -91,8 +91,14 @@ def FindBuildRecordFromLog(description, build_info): point.) """ for build_log in build_info: - if description in build_log['reason']: - return build_log + property_list = build_log['properties'] + for prop in property_list: + if len(prop) < 2: + continue + pname = prop[0] + pvalue = prop[1] + if pname == 'name' and pvalue == description: + return build_log return {} @@ -236,7 +242,7 @@ def GetTrybotImage(chromeos_root, command_prefix = '' if not patch_arg: command_prefix = 'yes | ' - command = ('%s ./cbuildbot --remote --nochromesdk --do-not-use-buildbucket %s' + command = ('%s ./cbuildbot --remote --nochromesdk %s' ' --remote-description=%s %s %s %s' % (command_prefix, optional_flags, description, toolchain_flags, patch_arg, build)) -- cgit v1.2.3 From 99d32c4981138fd11e6b351b6be9311932293464 Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Mon, 24 Apr 2017 20:34:43 -0700 Subject: buildbot_test_toolchains: get latest instead green vanilla build So as to work around the problem that some builders' latest green builds are too old. BUG=chromium:714890 TEST=Tested _GetVanillaImageName locally. Change-Id: I06571f3d55743fb56977d7ef56a51fcddfdda62e Reviewed-on: https://chromium-review.googlesource.com/486086 Reviewed-by: Manoj Gupta Commit-Queue: Ting-Yuan Huang Tested-by: Ting-Yuan Huang Trybot-Ready: Ting-Yuan Huang --- cros_utils/buildbot_utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cros_utils/buildbot_utils.py') diff --git a/cros_utils/buildbot_utils.py b/cros_utils/buildbot_utils.py index d24ba0d3..f89bb71a 100644 --- a/cros_utils/buildbot_utils.py +++ b/cros_utils/buildbot_utils.py @@ -8,6 +8,7 @@ from __future__ import print_function import base64 import json import os +import re import time import urllib2 @@ -388,3 +389,22 @@ def WaitForImage(chromeos_root, build): logger.GetLogger().LogOutput('Image %s not found, waited for %d hours' % (build, (TIME_OUT / 3600))) raise BuildbotTimeout('Timeout while waiting for image %s' % build) + + +def GetLatestImage(chromeos_root, path): + """Get latest image""" + + fmt = re.compile(r'R([0-9]+)-([0-9]+).([0-9]+).([0-9]+)') + + ce = command_executer.GetCommandExecuter() + command = ('gsutil ls gs://chromeos-image-archive/%s' % path) + _, out, _ = ce.ChrootRunCommandWOutput( + chromeos_root, command, print_to_console=False) + candidates = [l.split('/')[-2] for l in out.split()] + candidates = map(fmt.match, candidates) + candidates = [[int(r) for r in m.group(1, 2, 3, 4)] for m in candidates if m] + candidates.sort(reverse=True) + for c in candidates: + build = '%s/R%d-%d.%d.%d' % (path, c[0], c[1], c[2], c[3]) + if DoesImageExist(chromeos_root, build): + return build -- cgit v1.2.3