[pypy-commit] buildbot default: Forbid "stop build" to be clicked with a blank field. More precisely, a

arigo pypy.commits at gmail.com
Thu Aug 25 03:22:57 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1015:1767edfa9b72
Date: 2016-08-25 09:22 +0200
http://bitbucket.org/pypy/buildbot/changeset/1767edfa9b72/

Log:	Forbid "stop build" to be clicked with a blank field. More
	precisely, a reason must be given which starts with "!". This
	condition is written down clearly in the error we get if we don't
	specify it, so it should not deter human beings, but be enough to
	stop accidents or 3rd-party bots.

diff --git a/bot2/pypybuildbot/master.py b/bot2/pypybuildbot/master.py
--- a/bot2/pypybuildbot/master.py
+++ b/bot2/pypybuildbot/master.py
@@ -6,6 +6,7 @@
 from buildbot.buildslave import BuildSlave
 from buildbot.status.html import WebStatus
 from buildbot.status.web import authz
+from buildbot.process.build import Build
 #from buildbot import manhole
 from pypybuildbot.pypylist import PyPyList, NumpyStatusList
 from pypybuildbot.ircbot import IRC  # side effects
@@ -18,6 +19,14 @@
             raise ValidationError, "Please write your name in the corresponding field."
         return ForceScheduler.force(self, owner, builder_name, **kwargs)
 
+# Forbid "stop build" without a reason that starts with "!"
+def _checkStopBuild(self, reason=""):
+    if ": !" not in reason:
+        raise ValidationError, "Please write a reason that starts with '!'."
+    return _baseStopBuild(self, reason)
+_baseStopBuild = Build.stopBuild
+Build.stopBuild = _checkStopBuild
+
 
 if we_are_debugging():
     channel = '#buildbot-test'


More information about the pypy-commit mailing list