[Buildbot-devel] string values from Force Build form

Vasily vasslitvinov at pisem.net
Wed May 14 09:35:20 UTC 2014


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"
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

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.


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140514/d4f5fefa/attachment.html>

More information about the devel mailing list