Reviewers: ulan,
Message:
PTAL
Description:
Add better remote control to push-to-trunk auto-roll script.
This CL enables controlling the automatic push-to-trunk via a settings file
.auto-roll in the home directory or via the v8 status app message.
Pushes can be disabled by setting .auto-roll to {"enable_auto_roll": false}
or
by adding the phrase "nopush" or "no push" to http://v8-status.appspot.com/.
Please review this at https://codereview.chromium.org/113973003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+71, -3 lines):
M tools/push-to-trunk/auto_roll.py
M tools/push-to-trunk/test_scripts.py
Index: tools/push-to-trunk/auto_roll.py
diff --git a/tools/push-to-trunk/auto_roll.py
b/tools/push-to-trunk/auto_roll.py
index
c7de2a7067554e1473baa2b996a6af67405c59a5..3ba4481534f7903ef848cf36a30b5472a261f9e8
100755
--- a/tools/push-to-trunk/auto_roll.py
+++ b/tools/push-to-trunk/auto_roll.py
@@ -26,15 +26,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import json
import optparse
+import os
import re
import sys
from common_includes import *
+SETTINGS_LOCATION = "SETTINGS_LOCATION"
+
CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-auto-roll-tempfile",
DOT_GIT_LOCATION: ".git",
+ SETTINGS_LOCATION: "~/.auto-roll",
}
@@ -52,6 +57,29 @@ class Preparation(Step):
self.CommonPrepare()
+class CheckAutoRollSettings(Step):
+ MESSAGE = "Checking settings file."
+
+ def RunStep(self):
+ settings_file = os.path.realpath(self.Config(SETTINGS_LOCATION))
+ if os.path.exists(settings_file):
+ settings_dict = json.loads(FileToText(settings_file))
+ if settings_dict.get("enable_auto_roll") is False:
+ self.Die("Push to trunk disabled by auto-roll settings file: %s"
+ % settings_file)
+
+
+class CheckTreeStatus(Step):
+ MESSAGE = "Checking v8 tree status message."
+
+ def RunStep(self):
+ status_url = "https://v8-status.appspot.com/current?format=json"
+ status_json = self.ReadURL(status_url, wait_plan=[5, 20, 300, 300])
+ message = json.loads(status_json)["message"]
+ if re.search(r"nopush|no push", message, flags=re.I):
+ self.Die("Push to trunk disabled by tree state: %s" % message)
+
+
class FetchLatestRevision(Step):
MESSAGE = "Fetching latest V8 revision."
@@ -115,6 +143,8 @@ def RunAutoRoll(config,
side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
step_classes = [
Preparation,
+ CheckAutoRollSettings,
+ CheckTreeStatus,
FetchLatestRevision,
CheckLastPush,
FetchLKGR,
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py
b/tools/push-to-trunk/test_scripts.py
index
cd65a2bdbbb65f3efe9b0aefc36f1ed3d953b546..334983cdbc4b44ee131db23de4bcdc8053b6fa86
100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -38,6 +38,7 @@ import auto_roll
from auto_roll import AutoRollOptions
from auto_roll import CheckLastPush
from auto_roll import FetchLatestRevision
+from auto_roll import SETTINGS_LOCATION
TEST_CONFIG = {
@@ -53,6 +54,7 @@ TEST_CONFIG = {
COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg",
CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium",
DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS",
+ SETTINGS_LOCATION: None,
}
@@ -746,8 +748,11 @@ Performance and stability improvements on all
platforms."""
def testAutoRoll(self):
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
+ TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
self.ExpectReadURL([
+ ["https://v8-status.appspot.com/current?format=json",
+ "{\"message\": \"Tree is throttled\"}"],
["https://v8-status.appspot.com/lkgr", Exception("Network problem")],
["https://v8-status.appspot.com/lkgr", "100"],
])
@@ -760,13 +765,46 @@ Performance and stability improvements on all
platforms."""
["svn log -1 --oneline ChangeLog", "r65 | Prepare push to trunk..."],
])
- auto_roll.RunAutoRoll(TEST_CONFIG,
- AutoRollOptions(MakeOptions(m=False, f=True)),
- self)
+ auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()),
self)
self.assertEquals("100", self.MakeStep().Restore("lkgr"))
self.assertEquals("101", self.MakeStep().Restore("latest"))
+ def testAutoRollStoppedBySettings(self):
+ TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
+ TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile()
+ TextToFile("{\"enable_auto_roll\": false}",
TEST_CONFIG[SETTINGS_LOCATION])
+
+ self.ExpectReadURL([])
+
+ self.ExpectGit([
+ ["status -s -uno", ""],
+ ["status -s -b -uno", "## some_branch\n"],
+ ["svn fetch", ""],
+ ])
+
+ def RunAutoRoll():
+ auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()),
self)
+ self.assertRaises(Exception, RunAutoRoll)
+
+ def testAutoRollStoppedByTreeStatus(self):
+ TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
+ TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
+
+ self.ExpectReadURL([
+ ["https://v8-status.appspot.com/current?format=json",
+ "{\"message\": \"Tree is throttled (no push)\"}"],
+ ])
+
+ self.ExpectGit([
+ ["status -s -uno", ""],
+ ["status -s -b -uno", "## some_branch\n"],
+ ["svn fetch", ""],
+ ])
+
+ def RunAutoRoll():
+ auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()),
self)
+ self.assertRaises(Exception, RunAutoRoll)
class SystemTest(unittest.TestCase):
def testReload(self):
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.