Modified: trunk/Tools/CISupport/ews-build/steps.py (293779 => 293780)
--- trunk/Tools/CISupport/ews-build/steps.py 2022-05-04 17:44:44 UTC (rev 293779)
+++ trunk/Tools/CISupport/ews-build/steps.py 2022-05-04 17:47:23 UTC (rev 293780)
@@ -549,6 +549,9 @@
owners = self.getProperty('owners', [])
revision = self.getProperty('github.head.sha')
+ if self.getProperty('project') != 'WebKit/WebKit':
+ self.setProperty('sensitive', True)
+
self.setProperty('change_id', revision[:HASH_LENGTH_TO_DISPLAY], 'ConfigureBuild')
title = f': {title}' if title else ''
@@ -4688,7 +4691,10 @@
comment += f'\n\nReviewed commits have been landed. Closing PR #{pr_number} and removing active labels.'
return comment
+ def hideStepIf(self, results, step):
+ return self.getProperty('sensitive', False)
+
class CheckPatchStatusOnEWSQueues(buildstep.BuildStep, BugzillaMixin):
name = 'check-status-on-other-ewses'
descriptionDone = ['Checked patch status on other queues']
@@ -4965,14 +4971,14 @@
return self.getProperty('github.number') and self.getProperty('reviewers_full_names')
def hideStepIf(self, results, step):
- return not self.doStepIf(step)
+ return not self.doStepIf(step) or self.getProperty('sensitive', False)
-class ValidateCommitMessage(shell.ShellCommand):
+class ValidateCommitMessage(steps.ShellSequence, ShellMixin):
name = 'validate-commit-message'
haltOnFailure = False
flunkOnFailure = True
- OOPS_RE = re.compile(r'\(OO*PP*S!\)')
+ OOPS_RE = 'OO*PP*S!'
REVIEWED_STRINGS = (
'Reviewed by',
'Unreviewed',
@@ -4982,38 +4988,38 @@
def __init__(self, **kwargs):
super(ValidateCommitMessage, self).__init__(logEnviron=False, timeout=60, **kwargs)
- self.summary = 'Patches have no commit message'
- def start(self, BufferLogObserverClass=logobserver.BufferLogObserver):
+ @defer.inlineCallbacks
+ def run(self, BufferLogObserverClass=logobserver.BufferLogObserver):
base_ref = self.getProperty('github.base.ref', DEFAULT_BRANCH)
head_ref = self.getProperty('github.head.ref', DEFAULT_BRANCH)
- self.command = ['git', 'log', head_ref, f'^{base_ref}']
+ self.commands = []
+ commands = [
+ f"git log {head_ref} ^{base_ref} | grep -q '{self.OOPS_RE}' && echo 'Commit message contains (OOPS!)' || test $? -eq 1",
+ "git log {} ^{} | grep -q '\\({}\\)' || echo 'No reviewer information in commit message'".format(
+ head_ref, base_ref,
+ '\\|'.join(self.REVIEWED_STRINGS),
+ ),
+ ]
+ for command in commands:
+ self.commands.append(util.ShellArg(command=self.shell_command(command), logname='stdio', haltOnFailure=True))
+
self.log_observer = BufferLogObserverClass(wantStderr=True)
self.addLogObserver('stdio', self.log_observer)
- return super(ValidateCommitMessage, self).start()
+ rc = yield super(ValidateCommitMessage, self).run()
- def getResultSummary(self):
- if self.results in (SUCCESS, FAILURE):
- return {'step': self.summary}
- return super(ValidateCommitMessage, self).getResultSummary()
-
- def evaluateCommand(self, cmd):
- rc = super(ValidateCommitMessage, self).evaluateCommand(cmd)
if rc == SKIPPED:
+ self.summary = 'Patches have no commit message'
return rc
- if rc == SUCCESS:
+ log_text = self.log_observer.getStdout().rstrip()
+ if log_text:
+ self.summary = log_text
+ rc = FAILURE
+ elif rc == SUCCESS:
self.summary = 'Validated commit message'
- log_text = self.log_observer.getStdout()
- if self.OOPS_RE.search(log_text):
- self.summary = 'Commit message contains (OOPS!)'
- rc = FAILURE
- elif all([candidate not in log_text for candidate in self.REVIEWED_STRINGS]):
- self.summary = 'No reviewer information in commit message'
- rc = FAILURE
-
else:
self.summary = 'Error parsing commit message'
rc = FAILURE
@@ -5024,6 +5030,11 @@
self.build.addStepsAfterCurrentStep([LeaveComment(), BlockPullRequest()])
return rc
+ def getResultSummary(self):
+ if self.results in (SUCCESS, FAILURE):
+ return {'step': self.summary}
+ return super(ValidateCommitMessage, self).getResultSummary()
+
def doStepIf(self, step):
return self.getProperty('github.number')
Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (293779 => 293780)
--- trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-05-04 17:44:44 UTC (rev 293779)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-05-04 17:47:23 UTC (rev 293780)
@@ -6206,57 +6206,17 @@
ExpectShell(workdir='wkdir',
logEnviron=False,
timeout=60,
- command=['git', 'log', 'eng/pull-request-branch', '^main'])
- + 0
- + ExpectShell.log('stdio', stdout='''[Merge-Queue] Add ValidateSquashed
-https://bugs.webkit.org/show_bug.cgi?id=238172
-<rdar://problem/90602594>
-
-Reviewed by Aakash Jain.'''),
- )
- self.expectOutcome(result=SUCCESS, state_string='Validated commit message')
- return self.runStep()
-
- def test_success_unreviewed(self):
- self.setupStep(ValidateCommitMessage())
- self.setProperty('github.number', '1234')
- self.setProperty('github.base.ref', 'main')
- self.setProperty('github.head.ref', 'eng/pull-request-branch')
- self.expectRemoteCommands(
- ExpectShell(workdir='wkdir',
+ command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q 'OO*PP*S!' && echo 'Commit message contains (OOPS!)' || test $? -eq 1"])
+ + 0, ExpectShell(workdir='wkdir',
logEnviron=False,
timeout=60,
- command=['git', 'log', 'eng/pull-request-branch', '^main'])
+ command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q '\\(Reviewed by\\|Unreviewed\\|Rubber-stamped by\\|Rubber stamped by\\)' || echo 'No reviewer information in commit message'"])
+ 0
- + ExpectShell.log('stdio', stdout='''[Merge-Queue] Add ValidateSquashed (Follow-up)
-https://bugs.webkit.org/show_bug.cgi?id=238172
-<rdar://problem/90602594>
-
-Unreviewed follow-up fix.'''),
+ + ExpectShell.log('stdio', stdout=''),
)
self.expectOutcome(result=SUCCESS, state_string='Validated commit message')
return self.runStep()
- def test_success_rubber_stamped(self):
- self.setupStep(ValidateCommitMessage())
- self.setProperty('github.number', '1234')
- self.setProperty('github.base.ref', 'main')
- self.setProperty('github.head.ref', 'eng/pull-request-branch')
- self.expectRemoteCommands(
- ExpectShell(workdir='wkdir',
- logEnviron=False,
- timeout=60,
- command=['git', 'log', 'eng/pull-request-branch', '^main'])
- + 0
- + ExpectShell.log('stdio', stdout='''[build.webkit.org] Support identifiers on dashboard
-https://bugs.webkit.org/show_bug.cgi?id=239473
-<rdar://problem/76852365>
-
-Rubber-stamped by Aakash Jain.'''),
- )
- self.expectOutcome(result=SUCCESS, state_string='Validated commit message')
- return self.runStep()
-
def test_failure_oops(self):
self.setupStep(ValidateCommitMessage())
self.setProperty('github.number', '1234')
@@ -6266,13 +6226,9 @@
ExpectShell(workdir='wkdir',
logEnviron=False,
timeout=60,
- command=['git', 'log', 'eng/pull-request-branch', '^main'])
- + 0
- + ExpectShell.log('stdio', stdout='''[Merge-Queue] Add ValidateSquashed
-https://bugs.webkit.org/show_bug.cgi?id=238172
-<rdar://problem/90602594>
-
-Reviewed by NOBODY (OOPS!)'''),
+ command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q 'OO*PP*S!' && echo 'Commit message contains (OOPS!)' || test $? -eq 1"])
+ + 1
+ + ExpectShell.log('stdio', stdout='Commit message contains (OOPS!)\n'),
)
self.expectOutcome(result=FAILURE, state_string='Commit message contains (OOPS!)')
rc = self.runStep()
@@ -6288,11 +6244,13 @@
ExpectShell(workdir='wkdir',
logEnviron=False,
timeout=60,
- command=['git', 'log', 'eng/pull-request-branch', '^main'])
+ command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q 'OO*PP*S!' && echo 'Commit message contains (OOPS!)' || test $? -eq 1"])
+ + 0, ExpectShell(workdir='wkdir',
+ logEnviron=False,
+ timeout=60,
+ command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q '\\(Reviewed by\\|Unreviewed\\|Rubber-stamped by\\|Rubber stamped by\\)' || echo 'No reviewer information in commit message'"])
+ 0
- + ExpectShell.log('stdio', stdout='''[Merge-Queue] Add ValidateSquashed
-https://bugs.webkit.org/show_bug.cgi?id=238172
-<rdar://problem/90602594>'''),
+ + ExpectShell.log('stdio', stdout='No reviewer information in commit message\n'),
)
self.expectOutcome(result=FAILURE, state_string='No reviewer information in commit message')
rc = self.runStep()