Diff
Modified: trunk/Tools/BuildSlaveSupport/ews-build/factories.py (257933 => 257934)
--- trunk/Tools/BuildSlaveSupport/ews-build/factories.py 2020-03-05 19:06:19 UTC (rev 257933)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories.py 2020-03-05 19:08:03 UTC (rev 257934)
@@ -27,9 +27,9 @@
from steps import (ApplyPatch, ApplyWatchList, CheckOutSource, CheckOutSpecificRevision, CheckPatchRelevance,
CheckStyle, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
DownloadBuiltProduct, ExtractBuiltProduct, FindModifiedChangeLogs, InstallGtkDependencies,
- InstallWpeDependencies, KillOldProcesses, PrintConfiguration, RunAPITests, RunBindingsTests,
- RunBuildWebKitOrgUnitTests, RunEWSBuildbotCheckConfig, RunEWSUnitTests, RunResultsdbpyTests,
- RunJavaScriptCoreTests, RunWebKit1Tests, RunWebKitPerlTests,
+ InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
+ RunAPITests, RunBindingsTests, RunBuildWebKitOrgUnitTests, RunEWSBuildbotCheckConfig, RunEWSUnitTests,
+ RunResultsdbpyTests, RunJavaScriptCoreTests, RunWebKit1Tests, RunWebKitPerlTests,
RunWebKitPyPython2Tests, RunWebKitPyPython3Tests, RunWebKitTests, SetBuildSummary, UpdateWorkingDirectory, ValidatePatch)
@@ -227,3 +227,5 @@
self.addStep(ApplyPatch())
self.addStep(FindModifiedChangeLogs())
self.addStep(CreateLocalGITCommit())
+ self.addStep(PushCommitToWebKitRepo())
+ self.addStep(SetBuildSummary())
Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps.py (257933 => 257934)
--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py 2020-03-05 19:06:19 UTC (rev 257933)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py 2020-03-05 19:08:03 UTC (rev 257934)
@@ -2488,3 +2488,55 @@
if self.results != SUCCESS:
return {u'step': u'Failed to create git commit'}
return shell.ShellCommand.getResultSummary(self)
+
+
+class PushCommitToWebKitRepo(shell.ShellCommand):
+ name = 'push-commit-to-webkit-repo'
+ descriptionDone = ['Pushed commit to WebKit repository']
+ command = ['git', 'svn', 'dcommit', '--rmdir']
+ commit_success_regexp = '^Committed r(?P<svn_revision>\d+)$'
+ haltOnFailure = False
+
+ def __init__(self, **kwargs):
+ shell.ShellCommand.__init__(self, timeout=5 * 60, logEnviron=False, **kwargs)
+
+ def start(self):
+ self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
+ self.addLogObserver('stdio', self.log_observer)
+ return shell.ShellCommand.start(self)
+
+ def evaluateCommand(self, cmd):
+ rc = shell.ShellCommand.evaluateCommand(self, cmd)
+ if rc == SUCCESS:
+ log_text = self.log_observer.getStdout() + self.log_observer.getStderr()
+ svn_revision = self.svn_revision_from_commit_text(log_text)
+ self.setProperty('bugzilla_comment_text', self.comment_text_for_bug(svn_revision))
+ commit_summary = 'Committed r{}'.format(svn_revision)
+ self.descriptionDone = commit_summary
+ self.setProperty('build_summary', 'Committed r{}'.format(svn_revision))
+ self.build.addStepsAfterCurrentStep([CommentOnBug(), RemoveFlagsOnPatch(), CloseBug()])
+ else:
+ self.setProperty('bugzilla_comment_text', self.comment_text_for_bug())
+ self.setProperty('build_finish_summary', 'Failed to commit to WebKit repository')
+ self.build.addStepsAfterCurrentStep([CommentOnBug(), SetCommitQueueMinusFlagOnPatch()])
+ return rc
+
+ def url_for_revision(self, revision):
+ return 'https://trac.webkit.org/changeset/{}'.format(revision)
+
+ def comment_text_for_bug(self, svn_revision=None):
+ patch_id = self.getProperty('patch_id', '')
+ if not svn_revision:
+ return 'commit-queue failed to commit attachment {} to WebKit repository.'.format(patch_id)
+ comment = 'Committed r{}: <{}>'.format(svn_revision, self.url_for_revision(svn_revision))
+ comment += '\n\nAll reviewed patches have been landed. Closing bug and clearing flags on attachment {}.'.format(patch_id)
+ return comment
+
+ def svn_revision_from_commit_text(self, commit_text):
+ match = re.search(self.commit_success_regexp, commit_text, re.MULTILINE)
+ return match.group('svn_revision')
+
+ def getResultSummary(self):
+ if self.results != SUCCESS:
+ return {u'step': u'Failed to push commit to Webkit repository'}
+ return shell.ShellCommand.getResultSummary(self)
Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py (257933 => 257934)
--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py 2020-03-05 19:06:19 UTC (rev 257933)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py 2020-03-05 19:08:03 UTC (rev 257934)
@@ -41,8 +41,8 @@
CompileWebKitToT, ConfigureBuild, CreateLocalGITCommit,
DownloadBuiltProduct, DownloadBuiltProductFromMaster, ExtractBuiltProduct, ExtractTestResults,
FindModifiedChangeLogs, InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses,
- PrintConfiguration, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests, ReRunWebKitTests,
- RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
+ PrintConfiguration, PushCommitToWebKitRepo, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests,
+ ReRunWebKitTests, RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
RunEWSBuildbotCheckConfig, RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests,
RunJSCTestsWithoutPatch, RunWebKit1Tests, RunWebKitPerlTests, RunWebKitPyPython2Tests,
RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsWithoutPatch, TestWithFailureCount,
@@ -3176,5 +3176,40 @@
self.expectOutcome(result=FAILURE, state_string='commit...@webkit.org does not have reviewer permissions')
return self.runStep()
+class TestPushCommitToWebKitRepo(BuildStepMixinAdditions, unittest.TestCase):
+ def setUp(self):
+ self.longMessage = True
+ return self.setUpBuildStep()
+
+ def tearDown(self):
+ return self.tearDownBuildStep()
+
+ def test_success(self):
+ self.setupStep(PushCommitToWebKitRepo())
+ self.expectRemoteCommands(
+ ExpectShell(workdir='wkdir',
+ timeout=300,
+ logEnviron=False,
+ command=['git', 'svn', 'dcommit', '--rmdir']) +
+ ExpectShell.log('stdio', stdout='Committed r256729') +
+ 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Committed r256729')
+ return self.runStep()
+
+ def test_failure(self):
+ self.setupStep(PushCommitToWebKitRepo())
+ self.expectRemoteCommands(
+ ExpectShell(workdir='wkdir',
+ timeout=300,
+ logEnviron=False,
+ command=['git', 'svn', 'dcommit', '--rmdir']) +
+ ExpectShell.log('stdio', stdout='Unexpected failure') +
+ 2,
+ )
+ self.expectOutcome(result=FAILURE, state_string='Failed to push commit to Webkit repository')
+ return self.runStep()
+
+
if __name__ == '__main__':
unittest.main()
Modified: trunk/Tools/ChangeLog (257933 => 257934)
--- trunk/Tools/ChangeLog 2020-03-05 19:06:19 UTC (rev 257933)
+++ trunk/Tools/ChangeLog 2020-03-05 19:08:03 UTC (rev 257934)
@@ -1,5 +1,22 @@
2020-03-05 Aakash Jain <aakash_j...@apple.com>
+ [ews] Add build step to push commit to WebKit repository
+ https://bugs.webkit.org/show_bug.cgi?id=208589
+
+ Reviewed by Jonathan Bedard.
+
+ * BuildSlaveSupport/ews-build/steps.py:
+ (PushCommitToWebKitRepo): Build step to push the local commit to WebKit repository.
+ (PushCommitToWebKitRepo.start): Initialize log observer.
+ (PushCommitToWebKitRepo.evaluateCommand): Check command return status and comment on bug accordingly.
+ (PushCommitToWebKitRepo.comment_text_for_bug): Generate comment text for commenting on bug.
+ (PushCommitToWebKitRepo.svn_revision_from_commit_text): Extract the svn revision from commit text.
+ (PushCommitToWebKitRepo.getResultSummary): Set custom failure message.
+ * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests.
+ * BuildSlaveSupport/ews-build/factories.py:
+
+2020-03-05 Aakash Jain <aakash_j...@apple.com>
+
[ews] Add unit tests for ValidateCommiterAndReviewer build step
https://bugs.webkit.org/show_bug.cgi?id=208262