<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 27, 2019 at 5:30 PM <<a href="mailto:users-request@buildbot.net">users-request@buildbot.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send users mailing list submissions to<br>
        <a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:users-request@buildbot.net" target="_blank">users-request@buildbot.net</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:users-owner@buildbot.net" target="_blank">users-owner@buildbot.net</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1.  Custom build step (Viraj Wadate)<br>
   2. Re:  Custom build step (Cl?ment Hurlin)<br>
   3.  Setting a property from a Complex Command (honas grael)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 26 Sep 2019 18:58:11 +0530<br>
From: Viraj Wadate <<a href="mailto:virajwadate@gmail.com" target="_blank">virajwadate@gmail.com</a>><br>
To: <a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
Subject: [<a href="mailto:users@bb.net" target="_blank">users@bb.net</a>] Custom build step<br>
Message-ID:<br>
        <CAEPrOE+uosL-XQ2nzeC6=<a href="mailto:rYh%2BQm4_x_ii_ML0Y479aOrwr65OQ@mail.gmail.com" target="_blank">rYh+Qm4_x_ii_ML0Y479aOrwr65OQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi<br>
<br>
I got stuck in buildbot for configuring custom buildbot step.<br>
<br>
Can you please help me with one of the example how we can create custom<br>
build step.<br>
<br>
Regards,<br>
Viraj Wadate<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.buildbot.net/pipermail/users/attachments/20190926/13cc94b0/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.buildbot.net/pipermail/users/attachments/20190926/13cc94b0/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 26 Sep 2019 15:43:01 +0200<br>
From: Cl?ment Hurlin <<a href="mailto:clement.hurlin@provenrun.com" target="_blank">clement.hurlin@provenrun.com</a>><br>
To: Viraj Wadate <<a href="mailto:virajwadate@gmail.com" target="_blank">virajwadate@gmail.com</a>>, <a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
Subject: Re: [<a href="mailto:users@bb.net" target="_blank">users@bb.net</a>] Custom build step<br>
Message-ID: <<a href="mailto:fb18092c-e064-3715-5014-79238f5f5191@provenrun.com" target="_blank">fb18092c-e064-3715-5014-79238f5f5191@provenrun.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Dear Viraj,<br>
<br>
What do you want to do with your custom step ?<br>
<br>
Shooting in the dark, here are simple custom steps I have in my bots, to<br>
provide you examples:<br>
<br>
class _ClearPropertyStep(steps.BuildStep):<br>
??? """<br>
??????? Step that clears a property<br>
??? """<br>
<br>
??? def __init__(self, prop, **kwargs):<br>
??????? steps.BuildStep.__init__(self, **kwargs)<br>
??????? assert prop is not None and len(prop) > 0<br>
??????? self.property = prop<br>
<br>
??? @defer.inlineCallbacks<br>
??? def run(self):<br>
??????? print("Clearing property " + self.property)<br>
??????? self.setProperty(self.property, None, str(type(self)))<br>
??????? yield defer.returnValue(SUCCESS)<br>
<br>
Here's another one:<br>
<br>
class _URLStep(steps.BuildStep):<br>
??? """<br>
??????? Step whose only purpose is to show a description and an URL<br>
??? """<br>
<br>
??? renderables = steps.BuildStep.renderables + [<br>
??????? 'url_text',<br>
??????? 'url',<br>
??? ]<br>
<br>
??? def __init__(self, url_text, url, **kwargs):<br>
??????? steps.BuildStep.__init__(self, **kwargs)<br>
??????? assert url_text is not None<br>
??????? self.url_text = url_text<br>
??????? assert url is not None<br>
??????? self.url = url<br>
<br>
??? @defer.inlineCallbacks<br>
??? def run(self):<br>
??????? print("Setting URL: " + str(self.url))<br>
??????? self.addURL(self.url_text, self.url)<br>
??????? yield defer.returnValue(SUCCESS)<br>
<br>
Best,<br>
<br>
Cl?ment Hurlin<br>
<br>
> Hi<br>
><br>
> I got stuck in buildbot for configuring custom buildbot step.<br>
><br>
> Can you please help me with one of the example how we can create<br>
> custom build step.<br>
><br>
> Regards,<br>
> Viraj Wadate<br>
><br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
> <a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.buildbot.net/pipermail/users/attachments/20190926/7719d24e/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.buildbot.net/pipermail/users/attachments/20190926/7719d24e/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 26 Sep 2019 20:05:55 +0100<br>
From: honas grael <<a href="mailto:honasgraeymael@gmail.com" target="_blank">honasgraeymael@gmail.com</a>><br>
To: Buildbot <<a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a>><br>
Subject: [<a href="mailto:users@bb.net" target="_blank">users@bb.net</a>] Setting a property from a Complex Command<br>
Message-ID:<br>
        <CADPsCNuJ2rN+=<a href="mailto:exG8xo6swfuGoDF5P328Dv1vvz42oX3eY0tNg@mail.gmail.com" target="_blank">exG8xo6swfuGoDF5P328Dv1vvz42oX3eY0tNg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello<br>
I would like to set a property from a command, after parsing the output of<br>
the command reading the docs<br>
<<a href="http://docs.buildbot.net/current/manual/configuration/buildsteps.html?highlight=setpropertyfromcommand#setpropertyfromcommand" rel="noreferrer" target="_blank">http://docs.buildbot.net/current/manual/configuration/buildsteps.html?highlight=setpropertyfromcommand#setpropertyfromcommand</a>><br>
I<br>
see<br>
<br>
def parseComplexCommandOutput(rc, stdout, stderr):<br>
    jpgs = [l.strip() for l in stdout.split('\n')]<br>
    return {'jpgs': jpgs}<br>
f.addStep(SetPropertyFromCommand(command="ls -1 *.jpg",<br>
extract_fn=parseComplexCommandOutput))<br>
<br>
<br>
This is almost what I am looking, except that my command is rather<br>
long and has dynamic parameters, something along the lines of,<br>
<br>
    command="select * from %s where build_number=%s" %(cmd_param1,cmd_param2)<br>
<br>
<br>
So I need to construct it first<br>
<br>
<br>
def complexCommand(props):<br>
    cmd_param1=str(my_sql)<br>
<br>
    cmd_param2 = props.getProperty('build_uid')<br>
<br>
    command="select * from %s where build_number=%s" %(cmd_param1,cmd_param2)<br>
    return command<br>
f.addStep(ShellCommand(command=complexCommand, extract_fn=glob2list))<br>
<br>
<br>
What I am trying to do is to run the command in complexCommand, and<br>
have the output sent to stdout<br>
<br>
so that parseComplexCommandOutput can parse it and extract the bits<br>
that I want to set a custom property.<br>
<br>
<br>
Is this possible?<br></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">You probably need to use a <a href="http://docs.buildbot.net/latest/manual/configuration/properties.html#renderer">renderer</a> (use the decorator @util.renderer with complexCommand function).</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I have done a similar task here: <a href="https://github.com/macports-gsoc/macports-buildbot/blob/master/master.cfg#L153" style="font-family:Arial,Helvetica,sans-serif">https://github.com/macports-gsoc/macports-buildbot/blob/master/master.cfg#L153</a></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Do I need a custom build step to do these 2 things?<br></blockquote><div><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">It should work even without a custom build step.</span> <span class="gmail_default" style="font-family:arial,helvetica,sans-serif">My example uses a <a href="https://github.com/macports-gsoc/macports-buildbot/blob/master/master.cfg#L143">custom buildstep</a> though.</span></div><div><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.buildbot.net/pipermail/users/attachments/20190926/fec56081/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.buildbot.net/pipermail/users/attachments/20190926/fec56081/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a><br>
<br>
------------------------------<br>
<br>
End of users Digest, Vol 51, Issue 6<br>
************************************<br>
</blockquote></div></div>