[Buildbot-devel] Using Properties numerically
Amber Yust
ayust at yelp.com
Fri May 4 19:45:54 UTC 2012
An alternate hack for running code at build time is to throw it in a step's
doStepIf function (and then have that always return true, if no other
conditional behavior is desired for that step).
Sent from Android
On May 4, 2012 12:13 PM, "Tom Prince" <tom.prince at ualberta.net> wrote:
> On Fri, 4 May 2012 10:08:20 -0700, Richard Offer <richard at whitequeen.com>
> wrote:
> > I need/want to be able to use a property value numerically, i.e.
> >
> > set_properties = {
> > 'SAUSAGEBOT_BUILDID' : 40000 + int(
> buildbot.process.properties.WithProperties("%(buildnumber:-0000)s") ),
> > },
>
> You can use Property instead of WithProperties to get a number, assuming
> that the property was originally specified as number (i.e. not set by
> SetProperties, for example).
>
> But, that won't allow you do arithmetic with it like you show above. The
> trouble is that the code written is evaluated at configure time, but you
> need the calculation done at build time. The way to do that, is to write
> an IRenderable instance that does what you want. (This basically
> involves writting a class with a method getRenderingFor.
>
> > Our existing build code (using bamboo) is all environment variable
> > driven, trying to get Properties in sync with environment variables
> > has proved to be magic - and not the good type…
>
> You don't necessarily need to keep them in sync. You can specify
> environment varialbes on the slave or builder or on indivual build
> steps. And if you want these to depend on properties, you can use
> WithProperties in the dicts these take.
>
> > I think the complexity has been trying to provide support for both
> > individual and system builds (the system build triggers all the
> > individual builds) - and I want to be able to use a single top level
> > build-id for all generated products (split across each of the
> > builders) - and that id is not the revision version.
> >
> > The "from the 1week newbie" take away is that the documentation and
> > examples around properties and their interaction with the system might
> > be better explained… I never could get SetPropertiesFromEnv to work
> > (probably because I wanted it on the slave not master).
>
> Certainly, the current documentation is lacking here. The handling of
> properties has become more flexible in the last few versions, and the
> documentation hasn't kept up. I hope to get some improved documentation
> written for 0.8.7. Any comments would be apprecieated.
>
> SetPropertiesFromEnv looks at the environment on the slave (which is the
> environment from which it is launched. One common source of confusion is
> that each BuildStep is run in a seperate shell, so that changes to the
> enviroment/working directory aren't propagated to other steps (in your
> case not SetPropertiesFromEnv).
>
> > Is there a way to configure the initial buildnumber on a one off basis
> > ? I don't want it to start from 0 when I roll this into production - I
> > don't what to confuse people with a lower build number than the system
> > I'm replacing…
>
> Therer isn't any direct way to do this, but it might be possible to
> manage it by poking around in the manhole. In general, I wouldn't
> suggest this, but for a one-of configuration this is probably not
> entirely unreasonable.
>
> Tom
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> 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/20120504/37382eb5/attachment.html>
More information about the devel
mailing list