| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import json | 5 import json |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from twisted.internet import defer | 8 from twisted.internet import defer |
| 9 from twisted.python import log | 9 from twisted.python import log |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 class _TryJobGerritPoller(GerritPoller): | 49 class _TryJobGerritPoller(GerritPoller): |
| 50 """Polls issues, creates changes and calls scheduler.submitJob. | 50 """Polls issues, creates changes and calls scheduler.submitJob. |
| 51 | 51 |
| 52 This class is a part of TryJobGerritScheduler implementation and not designed | 52 This class is a part of TryJobGerritScheduler implementation and not designed |
| 53 to be used otherwise. | 53 to be used otherwise. |
| 54 """ | 54 """ |
| 55 | 55 |
| 56 change_category = 'tryjob' | 56 change_category = 'tryjob' |
| 57 | 57 |
| 58 MESSAGE_REGEX_TRYJOB = re.compile('Patch set \d+:\s+\!tryjob(.*)', re.I) | 58 MESSAGE_REGEX_TRYJOB = re.compile('!tryjob(.*)$', re.I) |
| 59 | 59 |
| 60 def __init__(self, scheduler, gerrit_host, gerrit_projects=None, | 60 def __init__(self, scheduler, gerrit_host, gerrit_projects=None, |
| 61 pollInterval=None): | 61 pollInterval=None): |
| 62 assert scheduler | 62 assert scheduler |
| 63 GerritPoller.__init__(self, gerrit_host, gerrit_projects, pollInterval) | 63 GerritPoller.__init__(self, gerrit_host, gerrit_projects, pollInterval) |
| 64 self.scheduler = scheduler | 64 self.scheduler = scheduler |
| 65 | 65 |
| 66 def _is_interesting_message(self, message): | 66 def _is_interesting_message(self, message): |
| 67 return self.MESSAGE_REGEX_TRYJOB.match(message['message']) | 67 return self.MESSAGE_REGEX_TRYJOB.match(message['message']) |
| 68 | 68 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 @defer.inlineCallbacks | 122 @defer.inlineCallbacks |
| 123 def submitJob(self, change, job): | 123 def submitJob(self, change, job): |
| 124 bsid = yield self.addBuildsetForChanges( | 124 bsid = yield self.addBuildsetForChanges( |
| 125 reason='tryjob', | 125 reason='tryjob', |
| 126 changeids=[change.number], | 126 changeids=[change.number], |
| 127 builderNames=job.builder_names, | 127 builderNames=job.builder_names, |
| 128 properties=change.properties) | 128 properties=change.properties) |
| 129 log.msg('Successfully submitted a Gerrit try job for %s: %s.' % | 129 log.msg('Successfully submitted a Gerrit try job for %s: %s.' % |
| 130 (change.who, job)) | 130 (change.who, job)) |
| 131 defer.returnValue(bsid) | 131 defer.returnValue(bsid) |
| OLD | NEW |