On Fri, Sep 27, 2019 at 5:30 PM <users-requ...@buildbot.net> wrote: > Send users mailing list submissions to > users@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-requ...@buildbot.net > > You can reach the person managing the list at > users-ow...@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 <virajwad...@gmail.com> > To: users@buildbot.net > Subject: [us...@bb.net] Custom build step > Message-ID: > <CAEPrOE+uosL-XQ2nzeC6= > ryh+qm4_x_ii_ml0y479aorwr6...@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.hur...@provenrun.com> > To: Viraj Wadate <virajwad...@gmail.com>, users@buildbot.net > Subject: Re: [us...@bb.net] Custom build step > Message-ID: <fb18092c-e064-3715-5014-79238f5f5...@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@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 <honasgraeym...@gmail.com> > To: Buildbot <users@buildbot.net> > Subject: [us...@bb.net] Setting a property from a Complex Command > Message-ID: > <CADPsCNuJ2rN+= > exg8xo6swfugodf5p328dv1vvz42ox3ey0...@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@buildbot.net > https://lists.buildbot.net/mailman/listinfo/users > > ------------------------------ > > End of users Digest, Vol 51, Issue 6 > ************************************ >
_______________________________________________ users mailing list users@buildbot.net https://lists.buildbot.net/mailman/listinfo/users