Ticket #56: customprops_trigger.diff

File customprops_trigger.diff, 2.9 KB (added by redsymbol, 12 years ago)

Custom props to triggers for 0.7.6. Assumes customprops076.tgz and customprops_web.diff from ticket #87 have been applied, as well as trigger.patch and bb-item56-0.7.6fix.patch from this ticket

  • status/web/builder.py

     
    134134        Custom properties can be passed from the web form.  To do
    135135        this, subclass this class, overriding the force() method.  You
    136136        can then determine the properties (usually from form values,
    137         by inspecting req.args), then passing them to this superclass
     137        by inspecting req.args), then pass them to this superclass
    138138        force method.
    139139       
    140140        @param custom_props: Custom properties to set on build
  • steps/trigger.py

     
    4747            self.step_status.setText(["interrupted"])
    4848
    4949    def start(self):
     50        custom_props = {}
    5051        self.running = True
    5152        ss = self.build.getSourceStamp()
    5253        if self.updateSourceStamp:
    5354            ss = SourceStamp(ss.branch, self.build.getProperty('got_revision'), ss.patch)
     55        custom_props = self.build.getCustomProperties()
    5456        # (is there an easier way to find the BuildMaster?)
    5557        all_schedulers = self.build.builder.botmaster.parent.allSchedulers()
    5658        all_schedulers = dict([(sch.name, sch) for sch in all_schedulers])
     
    6466            if all_schedulers.has_key(scheduler):
    6567                sch = all_schedulers[scheduler]
    6668                if isinstance(sch, Triggerable):
    67                     dl.append(sch.trigger(ss))
     69                    dl.append(sch.trigger(ss, custom_props))
    6870                    triggered_schedulers.append(scheduler)
    6971                else:
    7072                    unknown_schedulers.append(scheduler)
  • scheduler.py

     
    705705    def getPendingBuildTimes(self):
    706706        return []
    707707
    708     def trigger(self, ss):
     708    def trigger(self, ss, custom_props={}):
    709709        """
    710710        Trigger this scheduler.  Returns a deferred that will fire when the buildset
    711711        is finished.
    712712        """
    713         bs = buildset.BuildSet(self.builderNames, ss)
     713        bs = buildset.BuildSet(self.builderNames, ss, custom_props=custom_props)
    714714        d = bs.waitUntilFinished()
    715715        self.submit(bs)
    716716        return d
  • process/base.py

     
    206206        properties can live."""
    207207        self.build_status.setProperty(propname, value)
    208208
     209    def getCustomProperties(self):
     210        return self.custom_properties
     211
    209212    def getProperty(self, propname):
    210213        return self.build_status.properties[propname]
    211214
    212 
    213215    def allChanges(self):
    214216        return self.source.changes
    215217