[Buildbot-devel] running a command if another fails?

Brian Warner warner-buildbot at lothar.com
Tue May 3 04:26:28 UTC 2005


> What's the best way to do this?  I thought of running "make check ||
> cat testsuite.log", but is there a better way?

Yeah, personally I'd just add a second step which does 'cat testsuite.log'.
That's what I did on the Trial tests, to retrieve the contents of
_trial_tmp/test.log . I've thought about adding a 'retrieve file' step that
would transfer a file from the buildslave to the master and then add the
contents to a LogFile object, but 'cat file' does almost exactly the same
thing, so there didn't seem to be much of a point.

Thomas's advice is sound, though. Another way to do it would be to have the
first step (the one that might fail) set self.build.testsFailed or something,
then have the second step (the one that you want to maybe not do) test the
same variable and sometimes return SKIPPED.

Yet another way that might avoid the "what happens if you insert steps"
problem would be to walk through self.build.steps looking for a step with the
right name, then look at its results.

It'd be nice if there were an easy way to write this (i.e. without having to
write so much code), since it's a really common use case.

cheers,
 -Brian





More information about the devel mailing list