Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: tools/push-to-trunk/auto_push.py

Issue 760793003: Push roll candidates based on candidate ref instead of lkgr. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 def RunStep(self): 64 def RunStep(self):
65 status_url = "https://v8-status.appspot.com/current?format=json" 65 status_url = "https://v8-status.appspot.com/current?format=json"
66 status_json = self.ReadURL(status_url, wait_plan=[5, 20, 300, 300]) 66 status_json = self.ReadURL(status_url, wait_plan=[5, 20, 300, 300])
67 self["tree_message"] = json.loads(status_json)["message"] 67 self["tree_message"] = json.loads(status_json)["message"]
68 if re.search(r"nopush|no push", self["tree_message"], flags=re.I): 68 if re.search(r"nopush|no push", self["tree_message"], flags=re.I):
69 self.Die("Push to trunk disabled by tree state: %s" 69 self.Die("Push to trunk disabled by tree state: %s"
70 % self["tree_message"]) 70 % self["tree_message"])
71 71
72 72
73 class FetchLKGR(Step): 73 class FetchCandidate(Step):
74 MESSAGE = "Fetching V8 LKGR." 74 MESSAGE = "Fetching V8 roll candidate ref."
75 75
76 def RunStep(self): 76 def RunStep(self):
77 lkgr_url = "https://v8-status.appspot.com/lkgr" 77 self.Git("fetch origin +refs/heads/candidate:refs/heads/candidate")
78 # Retry several times since app engine might have issues. 78 self["candidate"] = self.Git("show-ref -s refs/heads/candidate")
79 self["lkgr"] = self.ReadURL(lkgr_url, wait_plan=[5, 20, 300, 300])
80 79
81 80
82 class CheckLastPush(Step): 81 class CheckLastPush(Step):
83 MESSAGE = "Checking last V8 push to trunk." 82 MESSAGE = "Checking last V8 push to trunk."
84 83
85 def RunStep(self): 84 def RunStep(self):
86 last_push = self.FindLastTrunkPush() 85 last_push = self.FindLastTrunkPush()
87 86
88 # Retrieve the bleeding edge revision of the last push from the text in 87 # Retrieve the bleeding edge revision of the last push from the text in
89 # the push commit message. 88 # the push commit message.
90 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) 89 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push)
91 last_push_be = PUSH_MESSAGE_RE.match(last_push_title).group(1) 90 last_push_be = PUSH_MESSAGE_RE.match(last_push_title).group(1)
92 91
93 if not last_push_be: # pragma: no cover 92 if not last_push_be: # pragma: no cover
94 self.Die("Could not retrieve bleeding edge revision for trunk push %s" 93 self.Die("Could not retrieve bleeding edge revision for trunk push %s"
95 % last_push) 94 % last_push)
96 95
97 if self["lkgr"] == last_push_be: 96 if self["candidate"] == last_push_be:
98 print "Already pushed current lkgr %s" % last_push_be 97 print "Already pushed current candidate %s" % last_push_be
99 return True 98 return True
100 99
101 100
102 class PushToCandidates(Step): 101 class PushToCandidates(Step):
103 MESSAGE = "Pushing to candidates if specified." 102 MESSAGE = "Pushing to candidates if specified."
104 103
105 def RunStep(self): 104 def RunStep(self):
106 print "Pushing lkgr %s to candidates." % self["lkgr"] 105 print "Pushing candidate %s to candidates." % self["candidate"]
107 106
108 args = [ 107 args = [
109 "--author", self._options.author, 108 "--author", self._options.author,
110 "--reviewer", self._options.reviewer, 109 "--reviewer", self._options.reviewer,
111 "--revision", self["lkgr"], 110 "--revision", self["candidate"],
112 "--force", 111 "--force",
113 ] 112 ]
114 113
115 if self._options.work_dir: 114 if self._options.work_dir:
116 args.extend(["--work-dir", self._options.work_dir]) 115 args.extend(["--work-dir", self._options.work_dir])
117 116
118 # TODO(machenbach): Update the script before calling it. 117 # TODO(machenbach): Update the script before calling it.
119 if self._options.push: 118 if self._options.push:
120 self._side_effect_handler.Call(push_to_trunk.PushToTrunk().Run, args) 119 self._side_effect_handler.Call(push_to_trunk.PushToTrunk().Run, args)
121 120
(...skipping 15 matching lines...) Expand all
137 return { 136 return {
138 "PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile", 137 "PERSISTFILE_BASENAME": "/tmp/v8-auto-push-tempfile",
139 "SETTINGS_LOCATION": "~/.auto-roll", 138 "SETTINGS_LOCATION": "~/.auto-roll",
140 } 139 }
141 140
142 def _Steps(self): 141 def _Steps(self):
143 return [ 142 return [
144 Preparation, 143 Preparation,
145 CheckAutoPushSettings, 144 CheckAutoPushSettings,
146 CheckTreeStatus, 145 CheckTreeStatus,
147 FetchLKGR, 146 FetchCandidate,
148 CheckLastPush, 147 CheckLastPush,
149 PushToCandidates, 148 PushToCandidates,
150 ] 149 ]
151 150
152 151
153 if __name__ == "__main__": # pragma: no cover 152 if __name__ == "__main__": # pragma: no cover
154 sys.exit(AutoPush().Run()) 153 sys.exit(AutoPush().Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698