From 681f59811760b640b64cb714d4169c7272652eba Mon Sep 17 00:00:00 2001 From: Dana Dahlstrom Date: Tue, 28 Nov 2023 18:00:00 -0800 Subject: [PATCH] Accept Git trailer Build-Id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … in place of Piper tag BUILD_NUMBER, to avoid corrupting Git trailers. Issue: 296119824 Reviewed-on: https://github.com/youtube/cobalt/pull/2013 --- cobalt/build/build_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cobalt/build/build_info.py b/cobalt/build/build_info.py index 52f44940406c..51172faeed9b 100755 --- a/cobalt/build/build_info.py +++ b/cobalt/build/build_info.py @@ -24,7 +24,7 @@ FILE_DIR = os.path.dirname(__file__) COMMIT_COUNT_BUILD_ID_OFFSET = 1000000 -_BUILD_ID_PATTERN = '^BUILD_NUMBER=([1-9][0-9]{6,})$' +_BUILD_ID_PATTERN = '^(Build-Id: |BUILD_NUMBER=)([1-9][0-9]{6,})$' _GIT_REV_PATTERN = '^GitOrigin-RevId: ([0-9a-f]{40})$' _COBALT_VERSION_PATTERN = '^#define COBALT_VERSION "(.*)"$' @@ -40,7 +40,7 @@ def get_build_id_and_git_rev_from_commits(cwd): match_build_id = compiled_build_id_pattern.search(output) if not match_build_id: return None, None - build_id = match_build_id.group(1) + build_id = match_build_id.group(2) # Gets git rev. compiled_git_rev_pattern = re.compile(_GIT_REV_PATTERN, flags=re.MULTILINE)