示例#1
0
    def getChangeQueue(self, change, existing=None):
        # creates a new change queue for every project-ref
        # combination.
        if existing:
            return DynamicChangeQueueContextManager(existing)

        # Don't use Pipeline.getQueue to find an existing queue
        # because we're matching project and (branch or ref).
        for queue in self.pipeline.queues:
            if (queue.queue[-1].change.project == change.project
                    and ((hasattr(change, 'branch')
                          and hasattr(queue.queue[-1].change, 'branch')
                          and queue.queue[-1].change.branch == change.branch)
                         or queue.queue[-1].change.ref == change.ref)):
                self.log.debug("Found existing queue %s", queue)
                return DynamicChangeQueueContextManager(queue)
        change_queue = model.ChangeQueue(self.pipeline,
                                         window=1,
                                         window_floor=1,
                                         window_increase_type='none',
                                         window_decrease_type='none')
        change_queue.addProject(change.project)
        self.pipeline.addQueue(change_queue)
        self.log.debug("Dynamically created queue %s", change_queue)
        return DynamicChangeQueueContextManager(change_queue)
示例#2
0
文件: independent.py 项目: zhucc/zuul
 def getChangeQueue(self, change, existing=None):
     # creates a new change queue for every change
     if existing:
         return DynamicChangeQueueContextManager(existing)
     change_queue = model.ChangeQueue(self.pipeline)
     change_queue.addProject(change.project)
     self.pipeline.addQueue(change_queue)
     self.log.debug("Dynamically created queue %s", change_queue)
     return DynamicChangeQueueContextManager(change_queue)
示例#3
0
 def getChangeQueue(self, change, existing=None):
     # We ignore any shared change queues on the pipeline and
     # instead create a new change queue for every change.
     if existing:
         return DynamicChangeQueueContextManager(existing)
     change_queue = model.ChangeQueue(self.pipeline)
     change_queue.addProject(change.project)
     self.pipeline.addQueue(change_queue)
     self.log.debug("Dynamically created queue %s", change_queue)
     return DynamicChangeQueueContextManager(change_queue)
示例#4
0
 def getChangeQueue(self, change, existing=None):
     if existing:
         return StaticChangeQueueContextManager(existing)
     queue = self.pipeline.getQueue(change.project)
     if queue:
         return StaticChangeQueueContextManager(queue)
     else:
         # There is no existing queue for this change. Create a
         # dynamic one for this one change's use
         change_queue = model.ChangeQueue(self.pipeline, dynamic=True)
         change_queue.addProject(change.project)
         self.pipeline.addQueue(change_queue)
         self.log.debug("Dynamically created queue %s", change_queue)
         return DynamicChangeQueueContextManager(change_queue)
示例#5
0
    def getChangeQueue(self, change, event, existing=None):
        log = get_annotated_logger(self.log, event)

        # Ignore the existing queue, since we can always get the correct queue
        # from the pipeline. This avoids enqueuing changes in a wrong queue
        # e.g. during re-configuration.
        queue = self.pipeline.getQueue(change.project)
        if queue:
            return StaticChangeQueueContextManager(queue)
        else:
            # There is no existing queue for this change. Create a
            # dynamic one for this one change's use
            change_queue = model.ChangeQueue(self.pipeline, dynamic=True)
            change_queue.addProject(change.project)
            self.pipeline.addQueue(change_queue)
            log.debug("Dynamically created queue %s", change_queue)
            return DynamicChangeQueueContextManager(change_queue)