diff options
author | Yunlian Jiang <yunlian@chromium.org> | 2018-04-10 15:56:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-04-10 21:55:20 -0700 |
commit | 52415c92f753e44e4509b457943944876f34dc58 (patch) | |
tree | 80b76dbda9eeabcc6e5756bdeac1d448e66d4db2 | |
parent | 7e81190904a5dc41d74c52a73dfbde6a0cbba37d (diff) | |
download | toolchain-utils-52415c92f753e44e4509b457943944876f34dc58.tar.gz |
buildbot_utils: change method to get buildbucketid
The infrastructure team changed the output of cros tryjob, we need
to change accordingly to get the buildbucketid from the output.
BUG=none
TEST=ParseTryjobBuildbucketId can get the buildbucketid from the new
output.
Change-Id: I389355cb4fae72b21859167e9e191cbcebfc64ae
Reviewed-on: https://chromium-review.googlesource.com/1006187
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
-rw-r--r-- | cros_utils/buildbot_utils.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cros_utils/buildbot_utils.py b/cros_utils/buildbot_utils.py index dcc4b57e..91ded3a3 100644 --- a/cros_utils/buildbot_utils.py +++ b/cros_utils/buildbot_utils.py @@ -5,6 +5,7 @@ from __future__ import print_function +import ast import json import os import re @@ -68,12 +69,10 @@ def ParseTryjobBuildbucketId(msg): Returns: buildbucket-id, which will be passed to `cros buildresult` """ - pattern = (r'Successfully sent PUT request to .* ' - r'\[buildbucket_id:([0-9]+)\].*') - for line in msg.split('\n'): - m = re.match(pattern, line) - if m: - return m.group(1) + output_list = ast.literal_eval(msg) + output_dict = output_list[0] + if 'buildbucket_id' in ouput_dict: + return output_dict['buildbucket_id'] return None @@ -109,7 +108,7 @@ def SubmitTryjob(chromeos_root, buildbot_name, patch_list, build_tag, # Launch buildbot with appropriate flags. build = buildbot_name description = build_tag - command = ('cros tryjob --yes --nochromesdk --remote-description %s' + command = ('cros tryjob --yes --json --nochromesdk --remote-description %s' ' %s %s %s' % (description, tryjob_flags, patch_arg, build)) _, out, _ = RunCommandInPath(chromeos_root, command) buildbucket_id = ParseTryjobBuildbucketId(out) |