[Buildbot-devel] Custom build properties - patches, try builds, future?

Roch Gadsdon rochg at bakbone.co.uk
Fri Jul 13 10:49:26 UTC 2007


Hello list,

I have a few thoughts / questions on custom build properties.

We have been using Paul Gain's patch to allow custom properties on  
the web force-build page. That's cool. I think a couple of further  
changes are needed to prevent exception throws when no custom build  
properties are defined and to prevent the patch breaking try builds  
and scheduled builds. (Diffs at end of post). Any feedback on those  
diffs welcomed.

Secondly, we have made some further patches of our own to support  
custom build properties for try builds. We use these to allow the  
user to specify which unit tests he wants to run so you can just ask  
the build slaves to try out particular tests in the area you're  
working on. So, is there any wider interest in these changes? If so,  
I can add some more resilience to the code and post a patch.

Lastly, I'm fairly new to BuildBot, but from what I can see there has  
been a reasonable level of interest in custom build properties, so it  
would be interesting to know if there are any plans to accept any of  
the patches into the code base or add alternative equivalent  
functionality.

Thanks in advance for any views / comments,

-- Roch Gadsdon


Diffs follow...


- To prevent exceptions in the web UI when no custom build properties  
are defined:

--- html.py	2007-07-13 10:37:49.000000000 +0100
+++ /usr/lib/python2.4/site-packages/buildbot/status/html.py	 
2007-07-12 09:49:02.000000000 +0100
@@ -570,20 +596,21 @@
      def make_user_defined_rows(self):
          userDefRows = name = type = label = value = ""
          customBuildProperties = self.status.getCustomBuildProperties()
-        for properties in customBuildProperties:
-            name = properties['propertyName']
-            type = properties['propertyType']
-            label = properties['propertyLabel']
-            if type == 'radio':
-                value = properties['groupValue']
-                field = "<input type=" + "\'" + type + "\'" +  
"name=" + "\'" + \
-                                name + "\'" + "value=" + "\'" +  
value + "\'" + " />"
-            else:
-                field = "<input type=" + "\'" + type + "\'" +  \
-                                "name=" + "\'" + name + "\'" + " />"
+        if None != customBuildProperties:
+            for properties in customBuildProperties:
+                name = properties['propertyName']
+                type = properties['propertyType']
+                label = properties['propertyLabel']
+                if type == 'radio':
+                    value = properties['groupValue']
+                    field = "<input type=" + "\'" + type + "\'" +  
"name=" + "\'" + \
+                        name + "\'" + "value=" + "\'" + value + "\'"  
+ " />"
+                else:
+                    field = "<input type=" + "\'" + type + "\'" +  \
+                        "name=" + "\'" + name + "\'" + " />"
-            userDefRows += make_row(label, field)
-            name = type = label = value = ""
+                    userDefRows += make_row(label, field)
+                    name = type = label = value = ""
          return userDefRows
@@ -596,10 +623,11 @@
          # Custom properties.
          custom_props = {}
          forceBuildProperties = self.status.getCustomBuildProperties()
-        for dict in forceBuildProperties:
-            for key, value in dict.iteritems():
-               if key == 'propertyName':
-                   custom_props[value] = request.args.get(value,  
[""])[0]
+        if None != forceBuildProperties:
+            for dict in forceBuildProperties:
+                for key, value in dict.iteritems():
+                    if key == 'propertyName':
+                        custom_props[value] = request.args.get 
(value, [""])[0]
          r = "The web-page 'force build' button was pressed by '%s':  
%s\n" \
              % (name, reason)


- To prevent the patch causing exceptions with BuildSet oriented  
builds (i.e. try and scheduled builds):

--- /root/porting/buildbot-0.7.5/buildbot/buildset.py	2006-12-11  
05:40:11.000000000 +0000
+++ /usr/lib/python2.4/site-packages/buildbot/buildset.py	2007-07-13  
11:43:14.000000000 +0100
@@ -10,13 +10,17 @@
      source.revision), or a build of a certain set of Changes
      (source.changes=list)."""
-    def __init__(self, builderNames, source, reason=None, bsid=None):
+    def __init__(self, builderNames, source, reason=None, bsid=None,  
custom_props=None):
          """
          @param source: a L{buildbot.sourcestamp.SourceStamp}
          """
          self.builderNames = builderNames
          self.source = source
          self.reason = reason
+        if None != custom_props:
+            self.custom_props = custom_props
+        else:
+            self.custom_props = {}
          self.stillHopeful = True
          self.status = bss = builder.BuildSetStatus(source, reason,
                                                     builderNames, bsid)
@@ -34,7 +38,10 @@
          # create the requests
          for b in builders:
-            req = base.BuildRequest(self.reason, self.source, b.name)
+            req = base.BuildRequest(self.reason,
+                                    self.source,
+                                    self.custom_props,
+                                    b.name)
              reqs.append((b, req))
              self.requests.append(req)
              d = req.waitUntilFinished()







More information about the devel mailing list