[users at bb.net] Setting a property from a Complex Command

honas grael honasgraeymael at gmail.com
Thu Sep 26 19:05:55 UTC 2019


Hello
I would like to set a property from a command, after parsing the output of
the command reading the docs
<http://docs.buildbot.net/current/manual/configuration/buildsteps.html?highlight=setpropertyfromcommand#setpropertyfromcommand>
I
see

def parseComplexCommandOutput(rc, stdout, stderr):
    jpgs = [l.strip() for l in stdout.split('\n')]
    return {'jpgs': jpgs}
f.addStep(SetPropertyFromCommand(command="ls -1 *.jpg",
extract_fn=parseComplexCommandOutput))


This is almost what I am looking, except that my command is rather
long and has dynamic parameters, something along the lines of,

    command="select * from %s where build_number=%s" %(cmd_param1,cmd_param2)


So I need to construct it first


def complexCommand(props):
    cmd_param1=str(my_sql)

    cmd_param2 = props.getProperty('build_uid')

    command="select * from %s where build_number=%s" %(cmd_param1,cmd_param2)
    return command
f.addStep(ShellCommand(command=complexCommand, extract_fn=glob2list))


What I am trying to do is to run the command in complexCommand, and
have the output sent to stdout

so that parseComplexCommandOutput can parse it and extract the bits
that I want to set a custom property.


Is this possible?

Do I need a custom build step to do these 2 things?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20190926/fec56081/attachment.html>


More information about the users mailing list