Commit e4bab454 authored by Dirk Pranke's avatar Dirk Pranke Committed by LUCI CQ

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

This reverts commit e7c05817.

Reason for revert: Whoops. chromium/src was updated. I was confused by a conversation on the #ops slack channel and my checkout being slightly out of date. I think the original change was actually okay.

Original change's description:
> Revert "presubmit: Don't skip OWNERS check when Bot-Commit+1 is present."
>
> This reverts commit 9757ad58.
>
> Reason for revert: We need to update callers first (e.g., //PRESUBMIT.py in chromium/src).
>
> Original change's description:
> > 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>
>
> Change-Id: I02c3d5ea2e65ef852d34a6816d04fe1cad82823a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775101
> Auto-Submit: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I2c1ae8c60938cbd9316e9075488cc7451068a2f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775103
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
Reviewed-by: 's avatarJason Clinton <jclinton@chromium.org>
Auto-Submit: Dirk Pranke <dpranke@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
parent e7c05817
......@@ -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"},
......
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