Merge lp:~tom.prince/twisted-trac-integration/updated-force-builds.py into lp:twisted-trac-integration

Proposed by Tom Prince
Status: Merged
Merged at revision: 69
Proposed branch: lp:~tom.prince/twisted-trac-integration/updated-force-builds.py
Merge into: lp:twisted-trac-integration
Diff against target: 123 lines (+15/-74)
1 file modified
tools/force-builds.py (+15/-74)
To merge this branch: bzr merge lp:~tom.prince/twisted-trac-integration/updated-force-builds.py
Reviewer Review Type Date Requested Status
Itamar Turner-Trauring Approve
Tom Prince Needs Resubmitting
Jean-Paul Calderone Needs Fixing
Review via email: mp+122557@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jean-Paul Calderone (exarkun) wrote :

I guess the username/password part of this probably looks alright. But the rest of the changes are wrong. Forcing of supported builders *only* is entirely intentional.

review: Needs Fixing
Revision history for this message
Tom Prince (tom.prince) wrote :

This still maintains that behavior:
 + ('forcescheduler', 'force-supported'),
along with https://bazaar.launchpad.net/~tom.prince/twisted-buildbot-configuration/for-buildbot-0.8.6/view/head:/master/master.cfg#L724
    forcesched.ForceScheduler(
        name='force-supported',
        repository=forcesched.FixedParameter(name='repository', default=''),
        branch=forcesched.StringParameter(name='branch', default=''),
        project=forcesched.FixedParameter(name="project", default=""),
        properties=[],
        builderNames=[ b['name'] for b in builders if b['category'] == 'supported' ]),

means that the script still only forces supported builders.

review: Needs Resubmitting
Revision history for this message
Itamar Turner-Trauring (itamarst) wrote :

Sounds good, please merge.

review: Approve
Revision history for this message
Itamar Turner-Trauring (itamarst) wrote :

Actually, I tried it, and got a page full o' red, with some complaints about 'bzr: ERROR: Unsupported protocol for url "svn:None"', possibly there other problems. I'm not sure if that's related to this script or not.

http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/log-python3-5932-2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/force-builds.py'
2--- tools/force-builds.py 2012-04-28 12:24:04 +0000
3+++ tools/force-builds.py 2012-09-03 17:23:19 +0000
4@@ -8,9 +8,9 @@
5 import os, sys, pwd, urllib
6
7 import twisted
8-from twisted.internet import reactor, defer, protocol
9+from twisted.internet import reactor
10 from twisted.python import log
11-from twisted.web import client, http, http_headers
12+from twisted.web import client, http_headers
13
14 VERSION = "0.1"
15
16@@ -23,43 +23,6 @@
17 version=VERSION, name=os.name, platform=sys.platform,
18 twisted=twisted.__version__, python=hex(sys.hexversion)))
19
20-
21-
22-class _CollectBody(protocol.Protocol):
23- def __init__(self, result):
24- self.result = result
25- self.buffer = []
26-
27-
28- def dataReceived(self, data):
29- self.buffer.append(data)
30-
31-
32- def connectionLost(self, reason):
33- if reason.check(client.ResponseDone):
34- self.result.callback("".join(self.buffer))
35- else:
36- self.result.errback(reason)
37-
38-
39-
40-class Disconnect(protocol.Protocol):
41- def makeConnection(self, transport):
42- transport.stopProducing()
43-
44-
45-
46-def readBody(response):
47- if response.code in (http.OK, http.FOUND):
48- result = defer.Deferred()
49- protocol = _CollectBody(result)
50- response.deliverBody(protocol)
51- return result
52- response.deliverBody(Disconnect())
53- raise Exception("Unexpected response code: %d", response.code)
54-
55-
56-
57 def main():
58 if len(sys.argv) == 3:
59 branch, comments = sys.argv[1:]
60@@ -73,50 +36,28 @@
61 if not branch.startswith('/branches/'):
62 branch = '/branches/' + branch
63
64- lock = defer.DeferredLock()
65- requests = []
66- def ebList(err):
67- log.err(err, "Build force failure")
68-
69- def forced(result, builder):
70- print 'Forced', builder, '.'
71+ def forced(result):
72+ print 'Forced.'
73
74 args = [
75- ('username', pwd.getpwuid(os.getuid())[0]),
76+ ('username', 'twisted'),
77+ ('passwd', 'matrix'),
78+ ('forcescheduler', 'force-supported'),
79 ('revision', ''),
80 ('submit', 'Force Build'),
81 ('branch', branch),
82- ('comments', comments)]
83+ ('reason', '%s: %s' % (pwd.getpwuid(os.getuid())[0], comments))]
84
85 agent = client.Agent(reactor, pool=client.HTTPConnectionPool(reactor))
86
87 headers = http_headers.Headers({'user-agent': [USER_AGENT]})
88- d = agent.request('GET', SUPPORTED_BUILDERS_URL, headers)
89- d.addCallback(readBody)
90- def gotBuilders(buildersText):
91- builders = buildersText.splitlines()
92-
93- if tests is not None:
94- builders.remove('documentation')
95- args.extend([
96- ('property1name', 'test-case-name'),
97- ('property1value', tests)])
98-
99- for builder in builders:
100-
101- def f(builder, headers):
102- print 'Forcing', builder, '...'
103- url = "http://buildbot.twistedmatrix.com/builders/" + builder + "/force"
104- url = url + '?' + '&'.join([k + '=' + urllib.quote(v) for (k, v) in args])
105- d = agent.request("GET", url, headers)
106- d.addCallback(readBody)
107- d.addCallback(forced, builder)
108- return d
109- requests.append(lock.run(f, builder, headers).addErrback(ebList))
110-
111- return defer.gatherResults(requests)
112- d.addCallback(gotBuilders)
113- d.addErrback(log.err)
114+
115+ print 'Forcing...'
116+ url = "http://buildbot.twistedmatrix.com/builders/_all/forceall"
117+ url = url + '?' + '&'.join([k + '=' + urllib.quote(v) for (k, v) in args])
118+ d = agent.request("GET", url, headers)
119+ d.addCallback(forced)
120+ d.addErrback(log.err, "Build force failure")
121 d.addCallback(lambda ign: reactor.stop())
122 reactor.run()
123 print 'See http://buildbot.twistedmatrix.com/boxes-supported?branch=%s' % (branch,)

Subscribers

People subscribed via source and target branches

to all changes: