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#2018
  • Loading branch information
cobalt-github-releaser-bot authored Nov 29, 2023
1 parent 6b27ea2 commit fb24a20
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 @@ -47,7 +47,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 @@ -160,7 +160,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 fb24a20

Please sign in to comment.