Commit d79c7345 by Nicolas Capens Committed by Nicolas Capens

Validate the bug ID format in Kokoro presubmit

Previously any line starting with Bug: was accepted. This change restricts it to Buganizer and Monorail bugs of the form: Bug: b/141892461 Bug: swiftshader:123 Note nothing else is accepted before or after this match (including whitespace). Multiple bug references must go on separate lines. This ensures the bug ID is recognized correctly by Buganizer, Monorail, and Gerrit tools that parse them out. Bug: b/141892461 Change-Id: I910b18eba1a2bb473f2713c088c408cb31867487 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39910 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent b0ca2a89
...@@ -40,11 +40,13 @@ function check() { ...@@ -40,11 +40,13 @@ function check() {
# Validate commit message # Validate commit message
function run_bug_in_commit_msg() { function run_bug_in_commit_msg() {
git log -1 --pretty=%B | grep -E '^Bug:|^Issue:|^Fixes:|^Regres:' git log -1 --pretty=%B | grep -E '^(Bug|Issue|Fixes):(\s?)((b\/)|(\w+:))([0-9]+)$|(^Regres:)'
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Git commit message must have a Bug: line." echo "Git commit message must have a Bug: line"
echo "followed by a bug ID in the form b/# for Buganizer bugs or"
echo "project:# for Monorail bugs (e.g. 'Bug: chromium:123')."
return 1 return 1
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment