diff options
author | Daniel Smith <daniel.smith@qt.io> | 2020-08-25 16:52:14 +0200 |
---|---|---|
committer | Daniel Smith <Daniel.Smith@qt.io> | 2020-09-08 09:39:46 +0000 |
commit | 0cbc25d0235de896a22dc1b08a6368fc3d9a643a (patch) | |
tree | d54bc94b6f26c89b5011feccb5812c953896ee6a /git-hooks/gerrit-bot | |
parent | a2ebc6aedfc217e2af4b02ae97c7a598e85daff9 (diff) |
Sanity Bot: Allow branches to be globally excluded
Occasionally, a branch may need to be globally excluded from
sanity-bot review. Such is the case in refs/meta/config, which is an
internal gerrit config branch, and will never conform to sanity-bot
review rules.
Updated syntax for excluded-projects: <project>[:<branch>]
where project can be the wildcard '*' to exclude a branch from
all projects.
Fixes: QTQAINFRA-3880
Change-Id: I2f7fb436021a8c87bd82f3091758acff97bd3d24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'git-hooks/gerrit-bot')
-rwxr-xr-x | git-hooks/gerrit-bot | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/git-hooks/gerrit-bot b/git-hooks/gerrit-bot index 8c3b684..faeb40d 100755 --- a/git-hooks/gerrit-bot +++ b/git-hooks/gerrit-bot @@ -49,8 +49,8 @@ use Gerrit::REST; # It is expected to dump a Gerrit ReviewInput JSON entity to stdout. # The output from all workers is merged. # excluded (optional) -# Space-separated list of exclusions of the form <project> or -# <project>:<branch>. +# Space-separated list of exclusions of the form <project>[:<branch>]. +# To globally exclude a branch, use *:<branch>. # maintainers (optional) # Space-separated list of reviewers to add on "special occasions". # verbose (default 0) @@ -153,8 +153,10 @@ sub process_commit($$$$$) $project =~ s,/$,,; # XXX Workaround QTQAINFRA-381 my $verdict = {}; my @invite; - if (defined($EXCLUDED_PROJECTS{$project}) || defined($EXCLUDED_PROJECTS{$project.":".$branch})) { - $verbose and print "===== ".strftime("%c", localtime(time()))." ===== excluding commit ".$ref." in ".$project."\n"; + if (defined($EXCLUDED_PROJECTS{$project}) + || defined($EXCLUDED_PROJECTS{"*:".$branch}) + || defined($EXCLUDED_PROJECTS{$project.":".$branch})) { + $verbose and print "===== ".strftime("%c", localtime(time()))." ===== excluding commit ".$ref." in ".$project." on branch ".$branch."\n"; $$verdict{message} = "(skipped)"; $$verdict{labels}{'Sanity-Review'} = 1; } else { |