Buildbot no longer supports Python 2.7 on the Buildbot master.
This page documents the latest, unreleased version of Buildbot. For documentation for released versions, see http://docs.buildbot.net/current/.
22.214.171.124. Shell Sequence¶
Some steps have a specific purpose, but require multiple shell commands to implement them.
For example, a build is often
configure; make; make install.
We have two ways to handle that:
Create one shell command with all these. To put the logs of each commands in separate logfiles, we need to re-write the script as
configure 1> configure_log; ...and to add these
logfilesargument of the buildstep. This has the drawback of complicating the shell script, and making it harder to maintain as the logfile name is put in different places.
ShellCommandinstances, but this loads the build UI unnecessarily.
ShellSequence is a class to execute not one but a sequence of shell commands during a build.
It takes as argument a renderable, or list of commands which are
Each such object represents a shell invocation.
ShellSequence argument aside from the common parameters is:
from buildbot.plugins import steps, util f.addStep(steps.ShellSequence( commands=[ util.ShellArg(command=['configure']), util.ShellArg(command=['make'], logfile='make'), util.ShellArg( command=['make', 'check_warning'], logfile='warning', warnOnFailure=True), util.ShellArg(command=['make', 'install'], logfile='make install') ]))
All these commands share the same configuration of
pty usage that can be setup the same way as in
ShellArg(self, command=None, logfile=None, haltOnFailure=False, flunkOnWarnings=False, flunkOnFailure=False, warnOnWarnings=False, warnOnFailure=False)¶
command – (see the
logfile – optional log file name, used as the stdio log of the command
warnOnFailureparameters drive the execution of the sequence, the same way steps are scheduled in the build. They have the same default values as for buildsteps - see Parameters Common to all Steps.
Any of the arguments to this class can be renderable.
Note that if
logfilename does not start with the prefix
stdio, that prefix will be set like
ShellSequence methods below tune the behavior of how the list of shell commands are executed, and can be overridden in subclasses.
oneCmd – a string or a list of strings, as rendered from a
Determine whether the command
oneCmdshould be executed. If
False, the result of the command will be recorded as SKIPPED. The default methods skips all empty strings and empty lists.
Return the status text of the step in the end. The default value is to set the text describing the execution of the last shell command.
commands – list of shell args
This method actually runs the shell sequence. The default
runShellSequence, but subclasses can override
runto perform other operations, if desired.