presubmit: Don't skip OWNERS check when Bot-Commit+1 is present.

Change-Id: I17b07796a86c5214e13a0058428889c1bb2b850d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2774080
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
changes/80/2774080/4
Edward Lesmes 4 years ago committed by LUCI CQ
parent 3db00f13d9
commit 9757ad5883

@ -1127,17 +1127,12 @@ def CheckOwnersFormat(input_api, output_api):
def CheckOwners(
input_api, output_api, source_file_filter=None, allow_tbr=True):
if input_api.change.issue:
# Skip OWNERS check when Bot-Commit label is approved. This label is
# intended for commits made by trusted bots that don't require review nor
# owners approval.
if input_api.gerrit.IsBotCommitApproved(input_api.change.issue):
return []
# Skip OWNERS check when Owners-Override label is approved. This is intended
# for global owners, trusted bots, and on-call sheriffs. Review is still
# required for these changes.
if input_api.gerrit.IsOwnersOverrideApproved(input_api.change.issue):
return []
# Skip OWNERS check when Owners-Override label is approved. This is intended
# for global owners, trusted bots, and on-call sheriffs. Review is still
# required for these changes.
if (input_api.change.issue
and input_api.gerrit.IsOwnersOverrideApproved(input_api.change.issue)):
return []
# Ignore tbr if not allowed for this repo.
tbr = input_api.tbr and allow_tbr

@ -446,9 +446,6 @@ class GerritAccessor(object):
return [v for v in label_info.get('all', [])
if v.get('value', 0) == max_value]
def IsBotCommitApproved(self, issue):
return bool(self._GetApproversForLabel(issue, 'Bot-Commit'))
def IsOwnersOverrideApproved(self, issue):
return bool(self._GetApproversForLabel(issue, 'Owners-Override'))

@ -2795,37 +2795,6 @@ the current line as well!
response=response,
expected_output='')
def testCannedCheckOwners_BotCommit(self):
response = {
"owner": {"email": "john@example.com"},
"labels": {"Bot-Commit": {
u'all': [
{
u'email': u'bot@example.com',
u'value': 1
},
],
u'approved': {u'email': u'bot@example.org'},
u'default_value': 0,
u'values': {u' 0': u'No score',
u'+1': u'Looks good to me'},
}},
"reviewers": {"REVIEWER": [{u'email': u'bot@example.com'}]},
}
self.AssertOwnersWorks(
approvers=set(),
modified_files={'foo/xyz.cc': ['john@example.com']},
response=response,
is_committing=True,
expected_output='')
self.AssertOwnersWorks(
approvers=set(),
modified_files={'foo/xyz.cc': ['john@example.com']},
is_committing=False,
response=response,
expected_output='')
def testCannedCheckOwners_OwnersOverride(self):
response = {
"owner": {"email": "john@example.com"},

Loading…
Cancel
Save