Skip to content

Latest commit

 

History

History
79 lines (50 loc) · 3.88 KB

shell_sequence.rst

File metadata and controls

79 lines (50 loc) · 3.88 KB

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 configure_log files as logfiles argument 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.
  • Create three :bbShellCommand instances, but this loads the build UI unnecessarily.

:bbShellSequence 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 ~buildbot.steps.shellsequence.ShellArg objects. Each such object represents a shell invocation.

The single :bbShellSequence argument aside from the common parameters is:

commands

A list of ~buildbot.steps.shellsequence.ShellArg objects or a renderable the returns a list of ~buildbot.steps.shellsequence.ShellArg objects.

from buildbot.plugins import steps, util

f.addStep(steps.ShellSequence(
    commands=[
        util.ShellArg(command=['configure']),
        util.ShellArg(command=['make'], logname='make'),
        util.ShellArg(command=['make', 'check_warning'], logname='warning',
                      warnOnFailure=True),
        util.ShellArg(command=['make', 'install'], logname='make install')
    ]))

All these commands share the same configuration of environment, workdir and pty usage that can be setup the same way as in :bbShellCommand.

The two :bbShellSequence methods below tune the behavior of how the list of shell commands are executed, and can be overridden in subclasses.