diff options
author | Jason Chan <jason.chan@10gen.com> | 2020-05-11 12:28:44 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-12 18:18:37 +0000 |
commit | 26008265842c4282c94f1723d83d2b1659cace2d (patch) | |
tree | a223e12762b2d886533bde90f37b20d0305136ef | |
parent | 25c694f365db0f07a445bd17b6cd5cbf32f5f2f9 (diff) | |
download | mongo-26008265842c4282c94f1723d83d2b1659cace2d.tar.gz |
SERVER-48086 Update commit hash parsing rules for multiversion blacklisting
-rwxr-xr-x | buildscripts/evergreen_gen_multiversion_tests.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/buildscripts/evergreen_gen_multiversion_tests.py b/buildscripts/evergreen_gen_multiversion_tests.py index 20395d892a6..bf15e5d98a8 100755 --- a/buildscripts/evergreen_gen_multiversion_tests.py +++ b/buildscripts/evergreen_gen_multiversion_tests.py @@ -4,6 +4,7 @@ import datetime import logging import os +import re import sys import tempfile from typing import Optional, List, Set @@ -92,11 +93,18 @@ def get_backports_required_last_stable_hash(task_path_suffix: str): last_stable_commit_hash = "" for line in shell_version.splitlines(): if "gitVersion" in line: - last_stable_commit_hash = line.split(':')[1].strip('"') - break - if not last_stable_commit_hash: - raise ValueError("Could not find a valid commit hash from the last-stable mongo binary.") - return last_stable_commit_hash + version_line = line.split(':')[1] + # We identify the commit hash as the string enclosed by double quotation marks. + result = re.search(r'"(.*?)"', version_line) + if result: + commit_hash = result.group().strip('"') + if not commit_hash.isalnum(): + raise ValueError(f"Error parsing last-stable commit hash. Expected an " + f"alpha-numeric string but got: {commit_hash}") + return commit_hash + else: + break + raise ValueError("Could not find a valid commit hash from the last-stable mongo binary.") def get_last_stable_yaml(last_stable_commit_hash, suite_name): |