Changeset 275613 in webkit
- Timestamp:
- Apr 7, 2021 10:58:00 AM (3 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/CISupport/ews-build/steps.py
r275287 r275613 3261 3261 log_text = self.log_observer.getStdout() + self.log_observer.getStderr() 3262 3262 svn_revision = self.svn_revision_from_commit_text(log_text) 3263 self.setProperty('bugzilla_comment_text', self.comment_text_for_bug(svn_revision)) 3264 commit_summary = 'Committed r{}'.format(svn_revision) 3263 identifier = self.identifier_for_revision(svn_revision) 3264 self.setProperty('bugzilla_comment_text', self.comment_text_for_bug(svn_revision, identifier)) 3265 commit_summary = 'Committed {}'.format(identifier) 3265 3266 self.descriptionDone = commit_summary 3266 self.setProperty('build_summary', 'Committed r{}'.format(svn_revision))3267 self.setProperty('build_summary', commit_summary) 3267 3268 self.build.addStepsAfterCurrentStep([CommentOnBug(), RemoveFlagsOnPatch(), CloseBug()]) 3268 self.addURL( 'r{}'.format(svn_revision), self.url_for_revision(svn_revision))3269 self.addURL(identifier, self.url_for_identifier(identifier)) 3269 3270 else: 3270 3271 retry_count = int(self.getProperty('retry_count', 0)) … … 3279 3280 return rc 3280 3281 3281 def url_for_revision(self, revision): 3282 return 'https://commits.webkit.org/r{}'.format(revision) 3283 3284 def comment_text_for_bug(self, svn_revision=None): 3282 def url_for_revision_details(self, revision): 3283 return '{}r{}/json'.format(COMMITS_INFO_URL, revision) 3284 3285 def url_for_identifier(self, identifier): 3286 return '{}{}'.format(COMMITS_INFO_URL, identifier) 3287 3288 def identifier_for_revision(self, revision): 3289 try: 3290 response = requests.get(self.url_for_revision_details(revision), timeout=60) 3291 if response and response.status_code == 200: 3292 return response.json().get('identifier', 'r{}'.format(revision)) 3293 else: 3294 print('Non-200 status code received from {}: {}'.format(COMMITS_INFO_URL, response.status_code)) 3295 print(response.text) 3296 except Exception as e: 3297 print(e) 3298 return 'r{}'.format(revision) 3299 3300 def comment_text_for_bug(self, svn_revision=None, identifier=None): 3285 3301 patch_id = self.getProperty('patch_id', '') 3286 3302 if not svn_revision: … … 3288 3304 comment += ' To retry, please set cq+ flag again.' 3289 3305 return comment 3290 comment = 'Committed r{}: <{}>'.format(svn_revision, self.url_for_revision(svn_revision)) 3306 3307 identifier_str = identifier if identifier and '@' in identifier else '?' 3308 comment = 'Committed r{} ({}): <{}>'.format(svn_revision, identifier_str, self.url_for_identifier(identifier)) 3291 3309 comment += '\n\nAll reviewed patches have been landed. Closing bug and clearing flags on attachment {}.'.format(patch_id) 3292 3310 return comment -
trunk/Tools/CISupport/ews-build/steps_unittest.py
r275287 r275613 35 35 from buildbot.test.util.steps import BuildStepMixin 36 36 from buildbot.util import identifiers as buildbot_identifiers 37 from mock import call 37 from mock import call, patch 38 38 from twisted.internet import defer, error, reactor 39 39 from twisted.python import failure, log … … 4090 4090 return self.tearDownBuildStep() 4091 4091 4092 def test_success(self): 4093 self.setupStep(PushCommitToWebKitRepo()) 4094 self.setProperty('patch_id', '1234') 4095 self.expectRemoteCommands( 4096 ExpectShell(workdir='wkdir', 4097 timeout=300, 4098 logEnviron=False, 4099 command=['git', 'svn', 'dcommit', '--rmdir']) + 4100 ExpectShell.log('stdio', stdout='Committed r256729') + 4101 0, 4102 ) 4103 self.expectOutcome(result=SUCCESS, state_string='Committed r256729') 4104 with current_hostname(EWS_BUILD_HOSTNAME): 4105 rc = self.runStep() 4106 self.assertEqual(self.getProperty('bugzilla_comment_text'), 'Committed r256729: <https://commits.webkit.org/r256729>\n\nAll reviewed patches have been landed. Closing bug and clearing flags on attachment 1234.') 4107 self.assertEqual(self.getProperty('build_finish_summary'), None) 4108 return rc 4092 def mock_commits_webkit_org(self, identifier=None): 4093 class Response(object): 4094 def __init__(self, data=None, status_code=200): 4095 self.status_code = status_code 4096 self.headers = {'Content-Type': 'text/json'} 4097 self.text = json.dumps(data or {}) 4098 4099 def json(self): 4100 return json.loads(self.text) 4101 4102 return patch( 4103 'requests.get', 4104 lambda *args, **kwargs: Response( 4105 data=dict(identifier=identifier) if identifier else dict(status='Not Found'), 4106 status_code=200 if identifier else 404, 4107 ) 4108 ) 4109 4110 def test_success(self): 4111 with self.mock_commits_webkit_org(identifier='220797@main'): 4112 self.setupStep(PushCommitToWebKitRepo()) 4113 self.setProperty('patch_id', '1234') 4114 self.expectRemoteCommands( 4115 ExpectShell(workdir='wkdir', 4116 timeout=300, 4117 logEnviron=False, 4118 command=['git', 'svn', 'dcommit', '--rmdir']) + 4119 ExpectShell.log('stdio', stdout='Committed r256729') + 4120 0, 4121 ) 4122 self.expectOutcome(result=SUCCESS, state_string='Committed 220797@main') 4123 with current_hostname(EWS_BUILD_HOSTNAME): 4124 rc = self.runStep() 4125 self.assertEqual(self.getProperty('bugzilla_comment_text'), 'Committed r256729 (220797@main): <https://commits.webkit.org/220797@main>\n\nAll reviewed patches have been landed. Closing bug and clearing flags on attachment 1234.') 4126 self.assertEqual(self.getProperty('build_finish_summary'), None) 4127 self.assertEqual(self.getProperty('build_summary'), 'Committed 220797@main') 4128 return rc 4129 4130 def test_success_no_identifier(self): 4131 with self.mock_commits_webkit_org(): 4132 self.setupStep(PushCommitToWebKitRepo()) 4133 self.setProperty('patch_id', '1234') 4134 self.expectRemoteCommands( 4135 ExpectShell(workdir='wkdir', 4136 timeout=300, 4137 logEnviron=False, 4138 command=['git', 'svn', 'dcommit', '--rmdir']) + 4139 ExpectShell.log('stdio', stdout='Committed r256729') + 4140 0, 4141 ) 4142 self.expectOutcome(result=SUCCESS, state_string='Committed r256729') 4143 with current_hostname(EWS_BUILD_HOSTNAME): 4144 rc = self.runStep() 4145 self.assertEqual(self.getProperty('bugzilla_comment_text'), 'Committed r256729 (?): <https://commits.webkit.org/r256729>\n\nAll reviewed patches have been landed. Closing bug and clearing flags on attachment 1234.') 4146 self.assertEqual(self.getProperty('build_finish_summary'), None) 4147 self.assertEqual(self.getProperty('build_summary'), 'Committed r256729') 4148 return rc 4109 4149 4110 4150 def test_failure_retry(self): -
trunk/Tools/ChangeLog
r275612 r275613 1 2021-04-07 Jonathan Bedard <jbedard@apple.com> 2 3 [build.webkit.org] Commit queue should post the identifier 4 https://bugs.webkit.org/show_bug.cgi?id=223829 5 <rdar://problem/75908321> 6 7 Reviewed by Aakash Jain. 8 9 * CISupport/ews-build/steps.py: 10 (PushCommitToWebKitRepo.url_for_revision): Use COMMITS_INFO_URL. 11 (PushCommitToWebKitRepo.url_for_identifier): Convert identifier 12 to commits.webkit.org URL. 13 (PushCommitToWebKitRepo.identifier_for_revision): Convert a commit 14 revision to an identifier string. 15 (PushCommitToWebKitRepo.comment_text_for_bug): Consult commits.webkit.org 16 to convert revision to identifier. 17 * CISupport/ews-build/steps_unittest.py: 18 1 19 2021-04-07 Aakash Jain <aakash_jain@apple.com> 2 20
Note: See TracChangeset
for help on using the changeset viewer.