How to add "&&" in shell command line in buildbot?

I need to use "& &" to execute several commands in one step. Therefore, I create a factory as shown below:

f1 = factory.BuildFactory()
f1.addStep(shell.ShellCommand, command=["sh", "-c", "pwd", "&&", "cd", "/home/xxx/yyy", "&&", "pwd"])

But at runtime, he found that buildbot processes it as shown below, making execution impossible

sh -c pwd '&&' cd /home/xxx/yyy '&&' pwd

I expected

sh -c pwd && cd /home/xxx/yyy && pwd

Can someone help me with this please? Thank.

+4
source share
1 answer

Since you are using /bin/sh, just call it with a single line:

f1.addStep(shell.ShellCommand, command="pwd && cd /home/xxx/yyy && pwd")

As the documentation says:

ShellCommand Arguments:

Team

() (), . argv. string ( ) , buildslave /bin/sh , , .

, , && . sh .

+3

All Articles