[users at bb.net] users Digest, Vol 51, Issue 6

Rajdeep Bharati rajdeepbharati13 at gmail.com
Fri Sep 27 12:47:29 UTC 2019


On Fri, Sep 27, 2019 at 5:30 PM <users-request at buildbot.net> wrote:

> Send users mailing list submissions to
>         users at buildbot.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.buildbot.net/mailman/listinfo/users
> or, via email, send a message with subject or body 'help' to
>         users-request at buildbot.net
>
> You can reach the person managing the list at
>         users-owner at buildbot.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of users digest..."
>
>
> Today's Topics:
>
>    1.  Custom build step (Viraj Wadate)
>    2. Re:  Custom build step (Cl?ment Hurlin)
>    3.  Setting a property from a Complex Command (honas grael)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 26 Sep 2019 18:58:11 +0530
> From: Viraj Wadate <virajwadate at gmail.com>
> To: users at buildbot.net
> Subject: [users at bb.net] Custom build step
> Message-ID:
>         <CAEPrOE+uosL-XQ2nzeC6=
> rYh+Qm4_x_ii_ML0Y479aOrwr65OQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi
>
> I got stuck in buildbot for configuring custom buildbot step.
>
> Can you please help me with one of the example how we can create custom
> build step.
>
> Regards,
> Viraj Wadate
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.buildbot.net/pipermail/users/attachments/20190926/13cc94b0/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 26 Sep 2019 15:43:01 +0200
> From: Cl?ment Hurlin <clement.hurlin at provenrun.com>
> To: Viraj Wadate <virajwadate at gmail.com>, users at buildbot.net
> Subject: Re: [users at bb.net] Custom build step
> Message-ID: <fb18092c-e064-3715-5014-79238f5f5191 at provenrun.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear Viraj,
>
> What do you want to do with your custom step ?
>
> Shooting in the dark, here are simple custom steps I have in my bots, to
> provide you examples:
>
> class _ClearPropertyStep(steps.BuildStep):
> ??? """
> ??????? Step that clears a property
> ??? """
>
> ??? def __init__(self, prop, **kwargs):
> ??????? steps.BuildStep.__init__(self, **kwargs)
> ??????? assert prop is not None and len(prop) > 0
> ??????? self.property = prop
>
> ??? @defer.inlineCallbacks
> ??? def run(self):
> ??????? print("Clearing property " + self.property)
> ??????? self.setProperty(self.property, None, str(type(self)))
> ??????? yield defer.returnValue(SUCCESS)
>
> Here's another one:
>
> class _URLStep(steps.BuildStep):
> ??? """
> ??????? Step whose only purpose is to show a description and an URL
> ??? """
>
> ??? renderables = steps.BuildStep.renderables + [
> ??????? 'url_text',
> ??????? 'url',
> ??? ]
>
> ??? def __init__(self, url_text, url, **kwargs):
> ??????? steps.BuildStep.__init__(self, **kwargs)
> ??????? assert url_text is not None
> ??????? self.url_text = url_text
> ??????? assert url is not None
> ??????? self.url = url
>
> ??? @defer.inlineCallbacks
> ??? def run(self):
> ??????? print("Setting URL: " + str(self.url))
> ??????? self.addURL(self.url_text, self.url)
> ??????? yield defer.returnValue(SUCCESS)
>
> Best,
>
> Cl?ment Hurlin
>
> > Hi
> >
> > I got stuck in buildbot for configuring custom buildbot step.
> >
> > Can you please help me with one of the example how we can create
> > custom build step.
> >
> > Regards,
> > Viraj Wadate
> >
> > _______________________________________________
> > users mailing list
> > users at buildbot.net
> > https://lists.buildbot.net/mailman/listinfo/users
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.buildbot.net/pipermail/users/attachments/20190926/7719d24e/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 26 Sep 2019 20:05:55 +0100
> From: honas grael <honasgraeymael at gmail.com>
> To: Buildbot <users at buildbot.net>
> Subject: [users at bb.net] Setting a property from a Complex Command
> Message-ID:
>         <CADPsCNuJ2rN+=
> exG8xo6swfuGoDF5P328Dv1vvz42oX3eY0tNg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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?
>

You probably need to use a renderer
<http://docs.buildbot.net/latest/manual/configuration/properties.html#renderer>
(use
the decorator @util.renderer with complexCommand function).
I have done a similar task here:
https://github.com/macports-gsoc/macports-buildbot/blob/master/master.cfg#L153

>
> Do I need a custom build step to do these 2 things?
>
It should work even without a custom build step. My example uses a custom
buildstep
<https://github.com/macports-gsoc/macports-buildbot/blob/master/master.cfg#L143>
though.

-------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.buildbot.net/pipermail/users/attachments/20190926/fec56081/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> users mailing list
> users at buildbot.net
> https://lists.buildbot.net/mailman/listinfo/users
>
> ------------------------------
>
> End of users Digest, Vol 51, Issue 6
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20190927/833cdfa0/attachment.html>


More information about the users mailing list