Skip to content
Permalink
Browse files
[EWS] Remove ChangeLog steps
https://bugs.webkit.org/show_bug.cgi?id=240542
<rdar://problem/93456184>

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/factories.py:
* Tools/CISupport/ews-build/steps.py:
(ValidateCommitterAndReviewer.start):
(SetBuildSummary.start):
(ValidateChangeLogAndReviewer): Deleted.
(FindModifiedChangeLogs): Deleted.
(CreateLocalGITCommit): Deleted.
* Tools/CISupport/ews-build/steps_unittest.py:

Canonical link: https://commits.webkit.org/250800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed May 20, 2022
1 parent ef7d11d commit 452ee7982845475da6114437f62e77ef79e8cf64
Showing 3 changed files with 6 additions and 292 deletions.
@@ -26,14 +26,14 @@

from steps import (AddAuthorToCommitMessage, AddReviewerToCommitMessage, ApplyPatch, ApplyWatchList, Canonicalize, CommitPatch,
CheckOutPullRequest, CheckOutSource, CheckOutSpecificRevision, CheckChangeRelevance,
CheckPatchStatusOnEWSQueues, CheckStyle, CleanGitRepo, CompileJSC, CompileWebKit, ConfigureBuild, CreateLocalGITCommit,
DetermineAuthor, DownloadBuiltProduct, ExtractBuiltProduct, FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitSvnFetch,
CheckPatchStatusOnEWSQueues, CheckStyle, CleanGitRepo, CompileJSC, CompileWebKit, ConfigureBuild,
DetermineAuthor, DownloadBuiltProduct, ExtractBuiltProduct, FetchBranches, FindModifiedLayoutTests, GitSvnFetch,
InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
RunAPITests, RunBindingsTests, RunBuildWebKitOrgUnitTests, RunBuildbotCheckConfigForBuildWebKit, RunBuildbotCheckConfigForEWS,
RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests, RunWebKit1Tests, RunWebKitPerlTests, RunWebKitPyPython2Tests,
RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsRedTree, RunWebKitTestsInStressMode, RunWebKitTestsInStressGuardmallocMode,
SetBuildSummary, ShowIdentifier, TriggerCrashLogSubmission, UpdateWorkingDirectory,
ValidateCommitMessage, ValidateChange, ValidateChangeLogAndReviewer, ValidateCommitterAndReviewer, WaitForCrashCollection,
ValidateCommitMessage, ValidateChange, ValidateCommitterAndReviewer, WaitForCrashCollection,
InstallBuiltProduct, VerifyGitHubIntegrity, ValidateSquashed)


@@ -1680,39 +1680,6 @@ def start(self):
return None


class ValidateChangeLogAndReviewer(shell.ShellCommand):
name = 'validate-changelog-and-reviewer'
descriptionDone = ['Validated ChangeLog and Reviewer']
command = ['python3', 'Tools/Scripts/webkit-patch', 'validate-changelog', '--check-oops', '--non-interactive']
haltOnFailure = False
flunkOnFailure = True

def __init__(self, **kwargs):
shell.ShellCommand.__init__(self, timeout=3 * 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 getResultSummary(self):
if self.results != SUCCESS:
return {'step': 'ChangeLog validation failed'}
return shell.ShellCommand.getResultSummary(self)

def evaluateCommand(self, cmd):
rc = shell.ShellCommand.evaluateCommand(self, cmd)
if rc == FAILURE:
log_text = self.log_observer.getStdout() + self.log_observer.getStderr()
self.setProperty('comment_text', log_text)
self.setProperty('build_finish_summary', 'ChangeLog validation failed')
self.build.addStepsAfterCurrentStep([
LeaveComment(),
SetCommitQueueMinusFlagOnPatch(), BlockPullRequest(),
])
return rc


class SetCommitQueueMinusFlagOnPatch(buildstep.BuildStep, BugzillaMixin):
name = 'set-cq-minus-flag-on-patch'

@@ -4475,103 +4442,6 @@ def start(self):
return defer.succeed(None)


class FindModifiedChangeLogs(shell.ShellCommand):
name = 'find-modified-changelogs'
descriptionDone = ['Found modified ChangeLogs']
command = ['git', 'diff', '-r', '--name-status', '--no-renames', '--no-ext-diff', '--full-index']
haltOnFailure = False

def __init__(self, **kwargs):
shell.ShellCommand.__init__(self, timeout=3 * 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 getResultSummary(self):
if self.results != SUCCESS:
patch_id = self.getProperty('patch_id', '')
return {'step': 'Failed to find any modified ChangeLog in Patch {}'.format(patch_id)}
return shell.ShellCommand.getResultSummary(self)

def evaluateCommand(self, cmd):
rc = shell.ShellCommand.evaluateCommand(self, cmd)
log_text = self.log_observer.getStdout() + self.log_observer.getStderr()
modified_changelogs = self.extract_changelogs(log_text, self._status_regexp('MA'))
self.setProperty('modified_changelogs', modified_changelogs)
if rc == FAILURE or not modified_changelogs:
patch_id = self.getProperty('patch_id', '')
message = 'Unable to find any modified ChangeLog in Patch {}'.format(patch_id)
if self.getProperty('buildername', '').lower() == 'commit-queue':
self.setProperty('comment_text', message.replace('Patch', 'Attachment'))
self.setProperty('build_finish_summary', message)
self.build.addStepsAfterCurrentStep([LeaveComment(), SetCommitQueueMinusFlagOnPatch()])
else:
self.build.buildFinished([message], FAILURE)
return rc

def is_path_to_changelog(self, path):
return os.path.basename(path) == 'ChangeLog'

def _status_regexp(self, expected_types):
return '^(?P<status>[{}])\t(?P<filename>.+)$'.format(expected_types)

def extract_changelogs(self, output, status_regexp):
filenames = []
for line in output.splitlines():
match = re.search(status_regexp, line)
if not match:
continue
filename = match.group('filename')
if self.is_path_to_changelog(filename):
filenames.append(filename)
return filenames


class CreateLocalGITCommit(shell.ShellCommand):
name = 'create-local-git-commit'
descriptionDone = ['Created local git commit']
haltOnFailure = False

def __init__(self, **kwargs):
shell.ShellCommand.__init__(self, timeout=5 * 60, logEnviron=False, **kwargs)

def start(self):
self.failure_message = None
modified_changelogs = self.getProperty('modified_changelogs')
patch_id = self.getProperty('patch_id', '')
if not modified_changelogs:
self.failure_message = 'No modified ChangeLog file found for Patch {}'.format(patch_id)
self.finished(FAILURE)
return None

modified_changelogs = ' '.join(modified_changelogs)
self.command = 'perl Tools/Scripts/commit-log-editor --print-log {}'.format(modified_changelogs)
self.command += ' | git commit --all -F -'
return shell.ShellCommand.start(self)

def getResultSummary(self):
if self.failure_message:
return {'step': self.failure_message}
if self.results != SUCCESS:
return {'step': 'Failed to create git commit'}
return shell.ShellCommand.getResultSummary(self)

def evaluateCommand(self, cmd):
rc = shell.ShellCommand.evaluateCommand(self, cmd)
if rc == FAILURE:
patch_id = self.getProperty('patch_id', '')
message = self.failure_message or 'Failed to create git commit for Patch {}'.format(patch_id)
if self.getProperty('buildername', '').lower() == 'commit-queue':
self.setProperty('comment_text', message.replace('Patch', 'Attachment'))
self.setProperty('build_finish_summary', message)
self.build.addStepsAfterCurrentStep([LeaveComment(), SetCommitQueueMinusFlagOnPatch()])
else:
self.build.buildFinished([message], FAILURE)
return rc


class PushCommitToWebKitRepo(shell.ShellCommand):
name = 'push-commit-to-webkit-repo'
descriptionDone = ['Pushed commit to WebKit repository']
@@ -46,9 +46,9 @@
AnalyzeJSCTestsResults, AnalyzeLayoutTestsResults, ApplyPatch, ApplyWatchList, ArchiveBuiltProduct, ArchiveTestResults, BugzillaMixin,
Canonicalize, CheckOutPullRequest, CheckOutSource, CheckOutSpecificRevision, CheckChangeRelevance, CheckPatchStatusOnEWSQueues, CheckStyle,
CleanBuild, CleanUpGitIndexLock, CleanGitRepo, CleanWorkingDirectory, ClosePullRequest, CompileJSC, CommitPatch, CompileJSCWithoutChange,
CompileWebKit, CompileWebKitWithoutChange, ConfigureBuild, ConfigureBuild, Contributors, CreateLocalGITCommit,
CompileWebKit, CompileWebKitWithoutChange, ConfigureBuild, ConfigureBuild, Contributors,
DetermineAuthor, DetermineLandedIdentifier, DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitHub, GitResetHard, GitSvnFetch,
FetchBranches, FindModifiedLayoutTests, GitHub, GitResetHard, GitSvnFetch,
InstallBuiltProduct, InstallGtkDependencies, InstallWpeDependencies,
KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo, PushPullRequestBranch, ReRunAPITests, ReRunWebKitPerlTests,
ReRunWebKitTests, ResetGitSvn, RevertPullRequestChanges, RunAPITests, RunAPITestsWithoutChange, RunBindingsTests, RunBuildWebKitOrgUnitTests,
@@ -58,7 +58,7 @@
RunWebKitTestsWithoutChange, RunWebKitTestsRedTree, RunWebKitTestsRepeatFailuresRedTree, RunWebKitTestsRepeatFailuresWithoutChangeRedTree,
RunWebKitTestsWithoutChangeRedTree, AnalyzeLayoutTestsResultsRedTree, TestWithFailureCount, ShowIdentifier,
Trigger, TransferToS3, UnApplyPatch, UpdatePullRequest, UpdateWorkingDirectory, UploadBuiltProduct,
UploadTestResults, ValidateCommitMessage, ValidateChangeLogAndReviewer, ValidateCommitterAndReviewer, ValidateChange,
UploadTestResults, ValidateCommitMessage, ValidateCommitterAndReviewer, ValidateChange,
VerifyGitHubIntegrity, ValidateSquashed)

# Workaround for https://github.com/buildbot/buildbot/issues/4669
@@ -424,43 +424,6 @@ def test_failure(self):
return self.runStep()


class TestValidateChangeLogAndReviewer(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True
return self.setUpBuildStep()

def tearDown(self):
return self.tearDownBuildStep()

def test_success(self):
self.setupStep(ValidateChangeLogAndReviewer())
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=180,
logEnviron=False,
command=['python3', 'Tools/Scripts/webkit-patch', 'validate-changelog', '--check-oops', '--non-interactive'])
+ 0,
)
self.expectOutcome(result=SUCCESS, state_string='Validated ChangeLog and Reviewer')
return self.runStep()

def test_failure(self):
self.setupStep(ValidateChangeLogAndReviewer())
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=180,
logEnviron=False,
command=['python3', 'Tools/Scripts/webkit-patch', 'validate-changelog', '--check-oops', '--non-interactive'])
+ ExpectShell.log('stdio', stdout='ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.')
+ 2,
)
self.expectOutcome(result=FAILURE, state_string='ChangeLog validation failed')
rc = self.runStep()
self.assertEqual(self.getProperty('comment_text'), 'ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.\n')
self.assertEqual(self.getProperty('build_finish_summary'), 'ChangeLog validation failed')
return rc


class TestRunBindingsTests(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True
@@ -4935,125 +4898,6 @@ def test_branch(self):
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()

class TestFindModifiedChangeLogs(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True
return self.setUpBuildStep()

def tearDown(self):
return self.tearDownBuildStep()

def test_modified_changelogs(self):
self.setupStep(FindModifiedChangeLogs())
self.assertEqual(FindModifiedChangeLogs.haltOnFailure, False)
self.setProperty('buildername', 'Commit-Queue')
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=180,
logEnviron=False,
command=['git', 'diff', '-r', '--name-status', '--no-renames', '--no-ext-diff', '--full-index']) +
ExpectShell.log('stdio', stdout='''M Source/WebCore/ChangeLog
M Source/WebCore/layout/blockformatting/BlockFormattingContext.h
M Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
M Tools/ChangeLog
M Tools/TestWebKitAPI/CMakeLists.txt''') +
0,
)
self.expectOutcome(result=SUCCESS, state_string='Found modified ChangeLogs')
rc = self.runStep()
self.assertEqual(self.getProperty('modified_changelogs'), ['Source/WebCore/ChangeLog', 'Tools/ChangeLog'])
self.assertEqual(self.getProperty('comment_text'), None)
self.assertEqual(self.getProperty('build_finish_summary'), None)
return rc

def test_success_added_changelog(self):
self.setupStep(FindModifiedChangeLogs())
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=180,
logEnviron=False,
command=['git', 'diff', '-r', '--name-status', '--no-renames', '--no-ext-diff', '--full-index']) +
ExpectShell.log('stdio', stdout='''A Tools/Scripts/ChangeLog
M Tools/Scripts/run-api-tests''') +
0,
)
self.expectOutcome(result=SUCCESS, state_string='Found modified ChangeLogs')
rc = self.runStep()
self.assertEqual(self.getProperty('modified_changelogs'), ['Tools/Scripts/ChangeLog'])
self.assertEqual(self.getProperty('comment_text'), None)
self.assertEqual(self.getProperty('build_finish_summary'), None)
return rc

def test_failure(self):
self.setupStep(FindModifiedChangeLogs())
self.setProperty('patch_id', '1234')
self.setProperty('buildername', 'Commit-Queue')
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=180,
logEnviron=False,
command=['git', 'diff', '-r', '--name-status', '--no-renames', '--no-ext-diff', '--full-index']) +
ExpectShell.log('stdio', stdout='Unexpected failure') +
2,
)
self.expectOutcome(result=FAILURE, state_string='Failed to find any modified ChangeLog in Patch 1234')
rc = self.runStep()
self.assertEqual(self.getProperty('comment_text'), 'Unable to find any modified ChangeLog in Attachment 1234')
self.assertEqual(self.getProperty('build_finish_summary'), 'Unable to find any modified ChangeLog in Patch 1234')
return rc


class TestCreateLocalGITCommit(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True
return self.setUpBuildStep()

def tearDown(self):
return self.tearDownBuildStep()

def test_success(self):
self.setupStep(CreateLocalGITCommit())
self.assertEqual(CreateLocalGITCommit.haltOnFailure, False)
self.setProperty('buildername', 'Commit-Queue')
self.setProperty('modified_changelogs', ['Tools/Scripts/ChangeLog', 'Source/WebCore/ChangeLog'])
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=300,
logEnviron=False,
command='perl Tools/Scripts/commit-log-editor --print-log Tools/Scripts/ChangeLog Source/WebCore/ChangeLog | git commit --all -F -') +
0,
)
self.expectOutcome(result=SUCCESS, state_string='Created local git commit')
rc = self.runStep()
self.assertEqual(self.getProperty('comment_text'), None)
self.assertEqual(self.getProperty('build_finish_summary'), None)
return rc

def test_failure_no_changelog(self):
self.setupStep(CreateLocalGITCommit())
self.setProperty('patch_id', '1234')
self.expectOutcome(result=FAILURE, state_string='No modified ChangeLog file found for Patch 1234')
return self.runStep()

def test_failure(self):
self.setupStep(CreateLocalGITCommit())
self.setProperty('patch_id', '1234')
self.setProperty('buildername', 'Commit-Queue')
self.setProperty('modified_changelogs', ['Tools/Scripts/ChangeLog'])
self.expectRemoteCommands(
ExpectShell(workdir='wkdir',
timeout=300,
logEnviron=False,
command='perl Tools/Scripts/commit-log-editor --print-log Tools/Scripts/ChangeLog | git commit --all -F -') +
ExpectShell.log('stdio', stdout='Unexpected failure') +
2,
)
self.expectOutcome(result=FAILURE, state_string='Failed to create git commit')
rc = self.runStep()
self.assertEqual(self.getProperty('comment_text'), 'Failed to create git commit for Attachment 1234')
self.assertEqual(self.getProperty('build_finish_summary'), 'Failed to create git commit for Patch 1234')
return rc


class TestValidateChange(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):

0 comments on commit 452ee79

Please sign in to comment.