[Buildbot-devel] How to integrate multiple commands into one BuildStep?
Brian Warner
warner-buildbot at lothar.com
Sat Dec 8 20:39:31 UTC 2007
> You could have:
>
> full_factory.addStep(step.ShellCommand, **basic_args(
> command="""for i in dist/*; do mv $i /var/www/packages; done
> rake clean
> rm -rf /var/www/packages/foobar-current.tgz
> cd /var/www/packages
> ln -s *.tar.gz foobar-current.tgz""",
> description="Publishing packages",
> descriptionDone="Published packages"))
Huh.. I'm surprised that that works. I wonder why..: the buildbot sees the
type(command)==str (as opposed to a list) and responds by prepending "/bin/sh
-c" to it. I guess /bin/sh -c accepts newlines in the last argument and
treats them as statement separators.
Like Ben said: neat trick!
> The reason why you might want to put everything into a single
> buildstep is that you preserve the same shell for every command that
> you run and you do not have to keep up with random external scripts
> all over the place in case you would want to mirror this system on a
> different box.
FWIW, my usual advice for build tools is to put the intelligence in the
Makefile and not in the buildbot config. The benefits include:
* the tool/logic gets version-controlled next to the code it is building
* the build logic is visible to all developers, not just the buildbot admin
* the logic can be tested independently of the buildbot
I frequently have Makefile targets like "make upload HOST=...", and have just
the hostname get filled in by the buildmaster config. That way I can test it
locally before asking the buildbot to take over upload duties.
cheers,
-Brian
More information about the devel
mailing list