I am trying to write a custom step, that will run few commands, and return a pas or fail based on certain conditions.
So far I was able to subclass ShellCommand; so I can execute a shell command on the slave. Now the next step is to write something that will execute not only one shell command, but various ones, and will analyze the results of these commands and act accordingly.
Altho I've not been successful in this endeavor. So far I am only able to subclass ShellCommand; but this allow me to run just one command. I have found that ShellCommand uses buildstep.remoteCommand and remoteShellCommand; but my attempts to subclass buildstep.BuildStep has been unsuccessful.
The objective that I want to accomplish is to run a finite amount of python or shell commands (without write a shell script and call it from python; I was able to accomplish that), and analyze the results coming from these operations, so I can dictate if a step pass or fail, and what is logged.
So far this is what I have:
class myclass(build step.BuildStep)
def __init__(self, **kwargs):
buildstep.BuildStep.__init__(self, **kwargs)
def start(self):
cmd=buildstep.RemoteShellCommand({'command':"ls -la"})
self.setupEnvironment(cmd)
d=self.runCommand(cmd)
return d
This will run, and I will get an error on the remoteShellCommand line, saying
exceptions.TypeError: __init__() takes at least 3 arguments (2 given)
I've tried with both remoteCommand and remoteShellCommand, and the result is the same. Checking init for both, I can't see 3 arguments but just the command, so I am not really sure what is wrong. I even tried to use **kwargs but I get an error saying that kwarg is not defined (there was an example from a blog, that would use kwargs; so I tried and it didn't work anyway).
This is the original documentation for the remoteShellCommand: [Original Buildbot API documentation][1]
Do you know where I could find an example that actually show me how to accomplish this, or at least how do you actually use remoteCommand/remoteShellCommand? The original docs are a mess, even google returns few results that are even more obscure than the original docs.
Any suggestion is welcome; I've been running in circles for the past 3 days, and have no idea about where to look next.