[Buildbot-devel] string values from Force Build form

Vasily vasslitvinov at pisem.net
Wed May 14 16:20:03 UTC 2014


Again - there's no way you can read that data while you're defining a step
- those addStep() calls take place *once* during Buildmaster startup!
So your code like

something = get_some_data()
my_factory.addStep(..., parameter=something)

won't work as you expect. Never. :)

Thanks,
Vasily


2014-05-14 20:03 GMT+04:00 Steve Bachor <steve.bachor at netronome.com>:

>
> Hi Vasily,
>
> Thanks for your answers.  It is useful to know the latest version works
> the same way as far as converting the objects to strings.
>
> I did notice the capability of defining new fields in web form (using
> ForceScheduler stuff) in the new version documentation, it is useful to
> hear confirmation of this. This feature may be the biggest reason we move
> to the latest version if it works well.
>
> I am still wondering if there is a way to get these four string names and
> values entered on the force build form (in 0.7.9) from a log file or a data
> structure before the log files are written.  I see the name(username),
> reason (comments), branch, and revision names and values (I entered) in the
> twistd.log after the build executes.  I want to access them in the same
> place in master.cfg as I said before.
>
> In a simplest case, I'm trying to set the workdir conditionally based on a
> value entered on the force build form.  Here's what I'm trying to do
> psuedocode:
>
> ---------------------------------------------------
> my_factory = factory.BuildFactory()
> .
> .
> .
> if (len("Revision to build" string value entered on Force Build form) > 0):
>       myrevision = ("Revision to build" string value entered on Force
> Build form)
> else:
>       myrevision = "anotherdefaultstring"
>
> my_factory.addStep(ShellCommand(descriptionDone="Finished Task",
>                                         description="Performing Task",
>                                         workdir=myrevision,
> .
> .
> .
> -------------------------------------------------------------
>
> Thanks again,
> Steve
>
>
> On 05/14/2014 05:35 AM, Vasily wrote:
>
> Hi!
>
>  Short answer: you cannot. Neither in 0.7.9 nor in latest version.
>
>  This stuff works a bit another way: master.cfg is executed once when
> Buildbot starts, and builders are defined once. Then their steps are
> executed each time something builds, e.g. when you click "Force build"
> button.
> That is how things work.
>
>  What you really need is WithProperties() usage, and you don't need to
> use their result directly, ShellCommand will convert those objects to
> strings itself.
>
>  As for name and reason... I believe they're not readily accessible, but
> in new version you can define new fields in web form (using ForceScheduler
> stuff) that are passed as properties, so you can replace those pre-defined
> fields by your custom ones.
>
>  Thanks,
> Vasily
>
>
> 2014-05-13 23:45 GMT+04:00 Steve Bachor <steve.bachor at netronome.com>:
>
>> Hello,
>>
>> We have been using buildbot version 0.7.9 for quite some time with much
>> success, thank you to the developers and the community.  We are
>> considering moving to latest version.
>>
>> ..but, if somebody can help me getting this to work with the version
>> 0.7.9 for now, it would be greatly appreciated. I suspect most of this
>> may be similar to latest version.
>>
>> I am simply trying to access the string values for the "Your name",
>> "Reason for build", "Branch to build", and "Revision to build" fields
>> that I have entered on the Force Build form prior to clicking the "Force
>> Build" button.  I am trying to access these string values from
>> master.cfg in the BUILDERS section prior to calling addStep.  I want to
>> copy these string values to new local variables for additional
>> processing/error checking and then pass the new local variables in
>> addStep.
>>
>> Here's similar to what I want to do:
>>
>> ---------------------------------------------------
>> smoke_factory = factory.BuildFactory()
>>
>> myname = ("Your name" string value from Force Build form)
>> myreason = ("Reason for build" string value from Force Build form)
>> mybranch = ("Branch to build" string value from Force Build form)
>> myrevision = ("Revision to build" string value from Force Build form)
>>
>> // pseudocode for processing the strings held by myname, myreason,
>> mybranch, and myrevision
>> // also access buildnumber here
>>
>> smoke_factory.addStep(ShellCommand(descriptionDone="Finished Task",
>>                                         description="Performing Task",
>>                                         workdir="/mybuilddir",
>>                                         timeout=timeout,
>>                                         command=["mypythonscript.py",
>>                                                   myname,
>>                                                   myreason,
>>                                                   mybranch,
>>                                                   myrevision]))
>> -------------------------------------------------------------
>>
>> We have been able to use WithProperties("%(branch)s") and
>> WithProperties("%(revision)s") as a parameter to the "mypythonscript.py"
>> but a couple problems with that:
>> 1. WithProperties("%(branch)s") and WithProperties("%(revision)s")
>> return an object not a string, I found documentation that said something
>> like "these are converted to a string only when passed to the buildslave".
>> 2. name and reason are not available to WithProperties, only branch and
>> revision.
>>
>> I briefly tried getting the above string values from log files without
>> success.
>>
>> Additionally, it would be great to access the buildnumber in the same
>> section of code (see above)
>>
>> Thanks in advance,
>>
>> Steve
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos.
>> Get unparalleled scalability from the best Selenium testing platform
>> available
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> _______________________________________________
>> Buildbot-devel mailing list
>> Buildbot-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>
>>
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140514/9fff5039/attachment.html>


More information about the devel mailing list