[Buildbot-devel] Enable force build of arbitrary revision
Brad Hards
bradh at frogmouth.net
Sat Oct 8 09:50:30 UTC 2005
During investigation in support of the SVN rework I recently suggested,
I implemented a simple change that allows the ability to force build of an
arbitrary revision from the web interface.
This is a bit nasty, in that I'm modifying a deprecated API, but it might
still be of general use.
Thoughts? Suggestions?
Brad
Index: buildbot/process/builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/builder.py,v
retrieving revision 1.31
diff -u -4 -p -r1.31 builder.py
--- buildbot/process/builder.py 7 Oct 2005 18:37:21 -0000 1.31
+++ buildbot/process/builder.py 8 Oct 2005 09:44:26 -0000
@@ -544,9 +544,9 @@ class BuilderControl(components.Adapter)
implements(interfaces.IBuilderControl)
else:
__implements__ = interfaces.IBuilderControl,
- def forceBuild(self, who, reason):
+ def forceBuild(self, who, reason, rev=None):
"""This is a shortcut for building the current HEAD.
(false: You get back a BuildRequest, just as if you'd asked politely.
To get control of the resulting build, you'll need use
@@ -566,9 +566,12 @@ class BuilderControl(components.Adapter)
if not idle_slaves:
if self.original.building:
raise interfaces.BuilderInUseError("All slaves are in use")
raise interfaces.NoSlaveError("There are no slaves connected")
- req = base.BuildRequest(reason, sourcestamp.SourceStamp())
+ if not rev:
+ req = base.BuildRequest(reason, sourcestamp.SourceStamp())
+ else:
+ req = base.BuildRequest(reason,
sourcestamp.SourceStamp(revision=rev))
self.requestBuild(req)
# this is a hack that fires the Deferred for the first build and
# ignores any others
class Watcher:
Index: buildbot/status/html.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/html.py,v
retrieving revision 1.68
diff -u -4 -p -r1.68 html.py
--- buildbot/status/html.py 2 Sep 2005 15:40:41 -0000 1.68
+++ buildbot/status/html.py 8 Oct 2005 09:44:27 -0000
@@ -407,8 +407,10 @@ class StatusResourceBuilder(HtmlResource
+ make_row("Your name:",
"<input type='text' name='username' />")
+ make_row("Reason for build:",
"<input type='text' name='comments' />")
+ + make_row("Revision to build:",
+ "<input type='text' name='revision' />")
+ """
<input type='submit' value='Force Build' />
</form>
""") % {"forceURL": forceURL}
@@ -432,17 +434,18 @@ class StatusResourceBuilder(HtmlResource
def force(self, request):
name = request.args.get("username", ["<unknown>"])[0]
reason = request.args.get("comments", ["<no reason specified>"])[0]
- r = "The web-page 'force build' button was pressed by '%s': %s\n" \
- % (name, reason)
+ revnum = request.args.get("revision", ["HEAD"])[0]
+ r = "The web-page 'force build' button was pressed by '%s': %s at
revision: %s\n" \
+ % (name, reason, revnum)
log.msg("web forcebuild of builder '%s'" % self.builder.name)
if self.control:
# TODO: if we can authenticate that a particular User pushed the
# button, use their name instead of None, so they'll be informed
of
# the results.
try:
- self.control.forceBuild(None, r)
+ self.control.forceBuild(None, reason, revnum)
except (interfaces.NoSlaveError, interfaces.BuilderInUseError):
# TODO: tell the web user that their request could not be
# honored
pass
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20051008/bab2a0dc/attachment.bin>
More information about the devel
mailing list