[Buildbot-devel] getting buildslaves to exit after one build?

Dan Kegel dank at kegel.com
Fri Aug 24 23:01:27 UTC 2012


On Fri, Aug 24, 2012 at 12:46 PM, John Carr <johnmdcarr at me.com> wrote:
> The libvirt code in buildbot is biased towards qemu/kvm - partially to get around the clone time issues (it uses the qemu-img COW support). So I doubt this would suit you anyway.
>
> It's not too hard to add a new latent slave if you just want to start and stop a container. Here's a generic one that covers the basics:
>
> https://gist.github.com/3454877
>
> The idea is you provide your own script to start and stop the container and the latent slave calls them at the right time.

Well... yeah... but all of that runs on the master, right?  So it
would require me to use ssh or something to talk to the slave machine
and ask it to start the container.
That won't work if I can't ssh to the slave machine.
(If virsh was up to controlling remote lxc's, maybe, but it's not as
far as I know.)

This is more what I was looking for:

diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py
index 3477444..327f3c4 100644
--- a/master/buildbot/process/build.py
+++ b/master/buildbot/process/build.py
@@ -246,6 +246,8 @@ class Build(properties.PropertiesMixin):
         def _release_slave(res, slave, bs):
             self.slavebuilder.buildFinished()
             slave.updateSlaveStatus(buildFinished=bs)
+            log.msg("Shutting down slave!");
+            slave.shutdown()
             return res
         d.addCallback(_release_slave, self.slavebuilder.slave, build_status)

(naturally conditional on some configuration flag)

With that, the buildslave will shut down after each build, the
container will exit,
and my outer script will start up a fresh container with a fresh buildbot.

Am I at risk of another build sneaking in on that slave during shutdown?




More information about the devel mailing list