[autotest] Be able to specify LATEST build as target build.
This change allows the user to specify running a suite against
a build name in the format [builder]/LATEST. This allows for users
to just use the latest build without looking it up.
BUG=chromium:375354
TEST=Tested running from run_suite, and afe. Then created a recurring
job that worked as desired.
DEPLOY=apache
CQ-DEPEND=Iddc2ab2b0675591b53311ebe9e1692d0c0859377
Change-Id: I5c0cd9ad06bd016b539902248e193115704ae243
Reviewed-on: https://chromium-review.googlesource.com/200822
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
diff --git a/server/site_utils.py b/server/site_utils.py
index 6f4c905..528a9a9 100644
--- a/server/site_utils.py
+++ b/server/site_utils.py
@@ -42,17 +42,22 @@
def ParseBuildName(name):
"""Format a build name, given board, type, milestone, and manifest num.
- @param name: a build name, e.g. 'x86-alex-release/R20-2015.0.0'
+ @param name: a build name, e.g. 'x86-alex-release/R20-2015.0.0' or a
+ relative build name, e.g. 'x86-alex-release/LATEST'
@return board: board the manifest is for, e.g. x86-alex.
@return type: one of 'release', 'factory', or 'firmware'
@return milestone: (numeric) milestone the manifest was associated with.
- @return manifest: manifest number, e.g. '2015.0.0'
+ Will be None for relative build names.
+ @return manifest: manifest number, e.g. '2015.0.0'.
+ Will be None for relative build names.
"""
- match = re.match(r'([\w-]+)-(\w+)/R(\d+)-([\d.ab-]+)', name)
- if match and len(match.groups()) == 4:
- return match.groups()
+ match = re.match(r'(?P<board>[\w-]+)-(?P<type>\w+)/(R(?P<milestone>\d+)-'
+ r'(?P<manifest>[\d.ab-]+)|LATEST)', name)
+ if match and len(match.groups()) == 5:
+ return (match.group('board'), match.group('type'),
+ match.group('milestone'), match.group('manifest'))
raise ParseBuildNameException('%s is a malformed build name.' % name)