[Buildbot-devel] Stopping a Build Upon Output

Brian Warner warner-buildbot at lothar.com
Mon Oct 9 17:11:42 UTC 2006


"Roy S. Rapoport" <buildbot-devel at ols.inorganic.org> writes:

> Now, a build may actually conclude with no changes (because nothing has
> had to be rebuilt).  I would love to find a way to:
> A) Based on output from a build step, determine this has happened; and
> B) When it happens, skip doing the tests.  This isn't a 'haltOnFailure'
> situation -- if it happens, we're all good and we want to say we're
> successful.

If you want to do this from the buildmaster side, I'd suggest making a
BuildStep subclass for your compile step that looks at the output and sets a
Build Property to indicate whether anything changed or not, something like:

    def createSummary():
        # grep logs
        if something_changed:
            self.setProperty("code-changed", True)
        else:
            self.setProperty("cod-changed", False)

Then make a BuildStep subclass for your test step that conditionally skips
the tests. You can override the start() method and have it return
buildbot.status.builder.SKIPPED to tell the rest of the build that this step
should be skipped:

    def start(self):
        if self.getProperty("code-changed"):
            return SKIPPED
        return ShellCommand.start(self)

(to be honest, I haven't used SKIPPED all that much, so I don't know offhand
how it gets displayed on the status page. There are a number of functions
that do stuff like 'if status==FAILED: blah; elif status==WARNINGS: blah;
else...', and there are plenty of ways to screw up those tests that would
cause all SKIPPED steps to be treated as FAILURE instead of the SUCCESS that
they should effectively represent. If you run into any of those, let me know,
so I can fix the bugs).



That said, I'm always in favor of putting the intelligence in your Makefiles
instead, because that way it is visible to all of your developers, not just
the buildbot admin. So I'd lean towards using Brett/Grig's suggestions. That
code on Grig's blog[1] is a good example of how to implement that approach.

cheers,
 -Brian


[1]: http://agiletesting.blogspot.com/2006/05/dynamically-updating-buildbot-status.html





More information about the devel mailing list