Skip to content

Commit

Permalink
Accept Git trailer Build-Id
Browse files Browse the repository at this point in the history
… in place of Piper tag BUILD_NUMBER, to avoid corrupting Git trailers.

(cherry picked from commit 0e24f1d)

Issue: 296119824
Reviewed-on: youtube/cobalt#2013
Reviewed-on: youtube/cobalt#2024
  • Loading branch information
cobalt-github-releaser-bot authored Nov 29, 2023
1 parent dd4a0c3 commit 07f2217
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cobalt/build/gyp_cobalt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ COMMIT_COUNT_BUILD_NUMBER_OFFSET = 1000000
# Matches numbers > 1000000. The pattern is basic so git log --grep is able to
# interpret it.
GIT_BUILD_NUMBER_PATTERN = r'[1-9]' + r'[0-9]' * 6 + r'[0-9]*'
BUILD_NUMBER_TAG_PATTERN = r'^BUILD_NUMBER={}$'
BUILD_NUMBER_TAG_PATTERN = r'^(Build-Id: |BUILD_NUMBER=){}$'

# git log --grep can't handle capture groups.
BUILD_NUBER_PATTERN_WITH_CAPTURE = '({})'.format(GIT_BUILD_NUMBER_PATTERN)
Expand Down Expand Up @@ -125,7 +125,7 @@ def GetBuildNumberFromCommits():
BUILD_NUMBER_TAG_PATTERN.format(BUILD_NUBER_PATTERN_WITH_CAPTURE),
flags=re.MULTILINE)
match = full_pattern_with_capture.search(output)
return match.group(1) if match else None
return match.group(2) if match else None


def GetBuildNumberFromServer():
Expand Down

0 comments on commit 07f2217

Please sign in to comment.