[Buildbot-devel] Retrieving build results

Dobes Vandermeer dobesv at gmail.com
Tue Nov 29 18:00:55 UTC 2005


This reminded me to include my environment variables patch.  This
works for the P4Poller change source so far - I can't make any
guarantees about anything else.

If no revision is specified, the environment variable isn't set - in
this case I get the head revision.  Also, you can use the reason
environment variable to decide whether to do a backup of files if you
want.

Currently I only use these when updating the tree to ensure that I
update to the revision buildbot thinks I will, but it should use other
steps.


Index: process/step.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
retrieving revision 1.77
diff -u -r1.77 step.py
--- process/step.py	5 Nov 2005 22:27:49 -0000	1.77
+++ process/step.py	9 Nov 2005 22:00:03 -0000
@@ -750,6 +758,15 @@
         # be referenced by later steps) can add keys to
         # self.build.slaveEnvironment to affect later steps.
         slaveEnv = self.build.slaveEnvironment
+        s = self.build.getSourceStamp()
+        if s.revision is not None:
+            slaveEnv['BUILDBOT_SOURCE_REVISION'] = str(s.revision)
+        elif s.changes:
+            changeNumbers = [c.revision for c in s.changes if
c.revision is not None]
+            if changeNumbers:
+                slaveEnv['BUILDBOT_SOURCE_REVISION'] = str(max(changeNumbers))
+        slaveEnv['BUILDBOT_SOURCE_BRANCH'] = str(s.branch)
+        slaveEnv['BUILDBOT_BUILD_REASON'] = str(self.build.reason)
         if slaveEnv:
             if self.cmd.args['env'] is None:
                 self.cmd.args['env'] = {}




On 11/29/05, Brian Warner <warner-buildbot at lothar.com> wrote:
> > However, that's not really the point.  I was more arguing that there
> > should be a nice way to determine the attributes of the build without
> > having to use 'svn info' - it would be nice if the current branch,
> > VC revision and whether it is a 'try' build could be provided to the
> > build step somehow.  Maybe the changes and the try patch too?
>
> Hmm. Yes, it would be nice to have these accessible from within the build
> process. I've also been thinking about some way to communicate other
> variables to the build process, specifically a set of test cases to run, for
> 'try' builds. I'd like to be able to say:
>
>  buildbot try buildbot.test.test_vc
>
> and have all the metabuildbot slaves run the "test_vc" test cases. To do this
> requires a number of changes, culminating in an additional argument being
> passed to their Trial steps. I'm not sure what the first changes should be..
> possibly adding a dictionary of arguments to the Build, or adding something
> wacky to the SourceStamp. I haven't thought of something that seems clean
> yet.
>
> Either this extra information (whether arguments like which tests to run, or
> build information like a revision and branch name) could be available to the
> BuildSteps and then they could be responsible for passing them into the
> remote commands, or it could be passed to *all* commands through environment
> variables. I'm inclined to go with the former, under the maxim that "explicit
> is better than implicit", but to make that useable I'd want to first make it
> easier to override the actual shell command being executed. This probably
> involves just a little refactoring of step.ShellCommand, but my concern is on
> how to make it easy to set up from within the config file. Something like
>
> def makeShellCommand(args):
>     return ["trial", "-v", args.get("testcases", "buildbot.test")]
> f = factory.BuildFactory([s(step.SVN, stuff=foo),
>                           s(step.Compile, stuff=foo),
>                           s(step.Trial, setup=makeShellCommand, stuff=foo)])
>
>
> anyway, that's what I vaguely have in mind. Let me know what you think.
>
>  -Brian
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>




More information about the devel mailing list