diff --git a/master/buildbot/buildslave/__init__.py b/master/buildbot/buildslave/__init__.py index 4ff2e3ca635..e142fc2ae9d 100755 --- a/master/buildbot/buildslave/__init__.py +++ b/master/buildbot/buildslave/__init__.py @@ -363,8 +363,9 @@ def updateRemovedBuilders(self): if buildername in removedBuilderList: selected_slave = build_status.getProperty('selected_slave') result = INTERRUPTED if selected_slave and selected_slave == self.slavename else RETRY - reason = 'Slave %s reconfigured, it has been removed from this builder.' % self.slavename - yield build_status.stopBuild(reason=reason, result=result) + reason = "Slave %s reconfigured, it has been removed from this builder." % self.slavename + text = ["Katana has been reconfigured, it will automatically retry this build"] + yield build_status.stopBuild(reason=reason, result=result, text=text) def updateSlave(self): """Called to add or remove builders after the slave has connected. diff --git a/master/buildbot/process/botmaster.py b/master/buildbot/process/botmaster.py index dd92ba073e7..65e8fc75337 100644 --- a/master/buildbot/process/botmaster.py +++ b/master/buildbot/process/botmaster.py @@ -253,7 +253,7 @@ def stopAllBuilds(self, builder): reason = "Builder %s has been removed" % builder.name for build_status in builder.builder_status.currentBuilds: - yield build_status.stopBuild(reason=reason, result=INTERRUPTED) + yield build_status.stopBuild(reason=reason, result=INTERRUPTED, text=[reason]) @defer.inlineCallbacks def reconfigServiceBuilders(self, new_config): diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py index 2f598dc57a0..4db78ede5ff 100644 --- a/master/buildbot/process/build.py +++ b/master/buildbot/process/build.py @@ -558,7 +558,7 @@ def lostRemote(self, remote=None): lock.stopWaitingUntilAvailable(self, access, d) d.callback(None) - def stopBuild(self, reason="", result=None): + def stopBuild(self, reason="", result=None, text=None): # the idea here is to let the user cancel a build because, e.g., # they realized they committed a bug and they don't want to waste # the time building something that they know will fail. Another @@ -579,6 +579,7 @@ def stopBuild(self, reason="", result=None): # TODO: validate result is valid katana result self.result = INTERRUPTED if result is None else result + self.text = text or self.text if self._acquiringLock: lock, access, d = self._acquiringLock @@ -595,7 +596,7 @@ def allStepsDone(self): elif self.result == EXCEPTION: text = ["Build Caught Exception"] elif self.result == RETRY: - text = ["Build Caught Exception, Will Retry"] + text = self.text or ["Katana will automatically retry this build"] elif self.result == INTERRUPTED: text = ["Build Interrupted"] else: diff --git a/master/buildbot/status/build.py b/master/buildbot/status/build.py index c649cead414..91cc5d4daf4 100644 --- a/master/buildbot/status/build.py +++ b/master/buildbot/status/build.py @@ -521,7 +521,7 @@ def checkLogfiles(self): s.checkLogfiles() @defer.inlineCallbacks - def stopBuild(self, reason, result=None): + def stopBuild(self, reason, result=None, text=None): if self.isFinished(): return @@ -531,7 +531,7 @@ def stopBuild(self, reason, result=None): if bldrc: bldc = bldrc.getBuild(self.getNumber()) if bldc: - yield bldc.stopBuild(reason=reason, result=result) + yield bldc.stopBuild(reason=reason, result=result, text=text) def cancelYourself(self): self.results = CANCELED diff --git a/master/buildbot/steps/trigger.py b/master/buildbot/steps/trigger.py index ce83a0a4b93..b7235b1ddb9 100644 --- a/master/buildbot/steps/trigger.py +++ b/master/buildbot/steps/trigger.py @@ -143,11 +143,22 @@ def finishIfRunning(self, result): if self.running: self.finished(result) - def checkDisconection(self, result, results): - if (isinstance(results, Failure) and results.check(TriggerableSchedulerStopped)) or results == RETRY: + def setResult(self, results): + was_reconfigured = (isinstance(results, Failure) and results.check(TriggerableSchedulerStopped)) + if was_reconfigured or results == RETRY: + if was_reconfigured: + self.setStatusText("Katana has been reconfigured") + result = RETRY self.addErrorResult(results) - return result + return result + + self.setStatusText("Dependency failed to build") + return DEPENDENCY_FAILURE + + def setStatusText(self, text): + self.step_status.setText([text]) + self.step_status.setText2(["(%s)" % text]) @defer.inlineCallbacks def start(self): @@ -208,11 +219,7 @@ def start(self): was_failure = True if was_exception or was_failure: - result = DEPENDENCY_FAILURE - self.step_status.setText(["Dependency failed to build."]) - self.step_status.setText2(["(dependency failed to build)"]) - result = self.checkDisconection(result, results) - + result = self.setResult(results) else: result = results if results in (SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, RETRY, CANCELED) else SUCCESS diff --git a/master/buildbot/test/unit/test_process_build.py b/master/buildbot/test/unit/test_process_build.py index dfa48c05c28..63bff53f86f 100644 --- a/master/buildbot/test/unit/test_process_build.py +++ b/master/buildbot/test/unit/test_process_build.py @@ -411,7 +411,7 @@ def acquireLocks(res=None): self.assert_(b.currentStep is None) self.assertEqual(b.result, RETRY) self.assert_( ('interrupt', ('stop it',), {}) not in step.method_calls) - self.build.build_status.setText.assert_called_with(['Build Caught Exception, Will Retry']) + self.build.build_status.setText.assert_called_with(['lost', 'remote']) self.build.build_status.setResults.assert_called_with(RETRY) def testStopBuildWaitingForStepLocks(self): diff --git a/master/buildbot/test/unit/test_steps_trigger.py b/master/buildbot/test/unit/test_steps_trigger.py index 0c6d8e1b79e..93f59deb281 100644 --- a/master/buildbot/test/unit/test_steps_trigger.py +++ b/master/buildbot/test/unit/test_steps_trigger.py @@ -446,7 +446,7 @@ def test_waitForFinish_failure(self): self.setupStep(trigger.Trigger(schedulerNames=['a'], waitForFinish=True)) self.scheduler_a.result = FAILURE - self.expectOutcome(result=DEPENDENCY_FAILURE, status_text=['Dependency failed to build.']) + self.expectOutcome(result=DEPENDENCY_FAILURE, status_text=['Dependency failed to build']) self.expectTriggeredWith(a=({}, {'stepname': ('Trigger', 'Trigger')}, 1)) self.expectTriggeredLinks('a') return self.runStep(expect_waitForFinish=True) @@ -457,7 +457,7 @@ def test_waitForFinish_exception(self): waitForFinish=True)) self.scheduler_b.exception = True self.expectOutcome(result=DEPENDENCY_FAILURE, - status_text=['Dependency failed to build.']) + status_text=['Dependency failed to build']) self.expectTriggeredWith( a=({}, {'stepname': ('Trigger', 'Trigger')}, 1), b=({}, {'stepname': ('Trigger', 'Trigger')}, 1))