Exemple #1
0
    def Update(self, c):
        for builder in self._builders:
            # Update the schedulers with the builder.
            schedulers = builder['schedulers']
            if schedulers:
                for scheduler in schedulers:
                    self._schedulers[scheduler]['builders'].append(
                        builder['name'])

            # Construct the category.
            categories = []
            if builder.get('category', None):
                categories.append(builder['category'])
            if builder.get('gatekeeper', None):
                categories.extend(builder['gatekeeper'].split('|'))
            category = '|'.join(categories)

            # Append the builder to the list.
            new_builder = {
                'name': builder['name'],
                'factory': self._factories[builder['factory']],
                'category': category,
                'auto_reboot': builder['auto_reboot']
            }
            if builder['builddir']:
                new_builder['builddir'] = builder['builddir']
            c['builders'].append(new_builder)

        # Process the main schedulers
        for s_name in self._schedulers:
            scheduler = self._schedulers[s_name]
            if scheduler['type'] == 'Scheduler':
                instance = Scheduler(
                    name=s_name,
                    branch=scheduler['branch'],
                    treeStableTimer=scheduler['treeStableTimer'],
                    builderNames=scheduler['builders'],
                    categories=scheduler['categories'])
                scheduler['instance'] = instance
                c['schedulers'].append(instance)

        # Process the dependent schedulers
        for s_name in self._schedulers:
            scheduler = self._schedulers[s_name]
            if scheduler['type'] == 'Dependent':
                c['schedulers'].append(
                    Dependent(
                        s_name,
                        self._schedulers[scheduler['parent']]['instance'],
                        scheduler['builders']))

        # Process the treggerable schedulers
        for s_name in self._schedulers:
            scheduler = self._schedulers[s_name]
            if scheduler['type'] == 'Triggerable':
                c['schedulers'].append(
                    Triggerable(s_name, scheduler['builders']))
Exemple #2
0
    def _create_schedulers(self):
        """Create all the schedulers, and add them to the config.

        """
        from buildbot.scheduler import Scheduler, Dependent
        scheds = {}
        for name in self.sched_order:
            item = self.scheduler_builders[name]
            kwargs = item[0]
            builders = item[1:]
            if "depends" in kwargs:
                upstream = kwargs['depends']
                if upstream not in scheds:
                    raise ConfigError(
                        "Scheduler name %r used in depends before being defined"
                        % name)
                upstream = scheds[upstream]
                sched = Dependent(name, upstream, builders)
            else:
                sched = Scheduler(name=name, builderNames=builders, **kwargs)
            scheds[name] = sched
            self.c['schedulers'].append(sched)
Exemple #3
0
 def __init__(self, name, upstream, builderNames, **kwargs):
     Dependent.__init__(self, name, upstream, builderNames)
     L10nMixin.__init__(self, **kwargs)
Exemple #4
0
  def Update(self, c):
    global_schedulers = dict((s.name, s) for s in c['schedulers']
                             if s.name.startswith('global_'))
    assert not (set(global_schedulers) & set(self._schedulers))

    for builder in self._builders:
      # Update the schedulers with the builder.
      schedulers = builder['schedulers']
      if schedulers:
        for scheduler in schedulers:
          if scheduler in global_schedulers:
            global_schedulers[scheduler].builderNames.append(builder['name'])
          else:
            self._schedulers[scheduler]['builders'].append(builder['name'])

      # Construct the category.
      categories = []
      if builder.get('category', None):
        categories.append(builder['category'])
      if builder.get('gatekeeper', None):
        categories.extend(builder['gatekeeper'].split('|'))
      category = '|'.join(categories)

      # Append the builder to the list.
      new_builder = {'name': builder['name'],
                     'factory': self._factories[builder['factory']],
                     'category': category,
                     'auto_reboot': builder['auto_reboot']}
      if builder['builddir']:
        new_builder['builddir'] = builder['builddir']
      if builder['slavebuilddir']:
        new_builder['slavebuilddir'] = builder['slavebuilddir']
      c['builders'].append(new_builder)

    # Process the main schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Scheduler':
        instance = Scheduler(name=s_name,
                             branch=scheduler['branch'],
                             treeStableTimer=scheduler['treeStableTimer'],
                             builderNames=scheduler['builders'],
                             categories=scheduler['categories'])
        scheduler['instance'] = instance
        c['schedulers'].append(instance)
      elif scheduler['type'] == 'URLScheduler':
        ident = str(uuid.uuid4())
        c['change_source'].append(
          URLPoller(changeurl=scheduler['url'],
                    pollInterval=scheduler['pollInterval'],
                    category=ident,
                    include_revision=scheduler['include_revision']))
        instance = Scheduler(name=s_name,
                             change_filter=ChangeFilter(category=ident),
                             builderNames=scheduler['builders'])
        scheduler['instance'] = instance
        c['schedulers'].append(instance)

    # Process the dependent schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Dependent':
        c['schedulers'].append(
            Dependent(s_name,
                      self._schedulers[scheduler['parent']]['instance'],
                      scheduler['builders']))

    # Process the triggerable schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Triggerable':
        c['schedulers'].append(Triggerable(s_name,
                                           scheduler['builders']))

    # Process the periodic schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Periodic':
        c['schedulers'].append(
            Periodic(s_name,
                     periodicBuildTimer=scheduler['periodicBuildTimer'],
                     builderNames=scheduler['builders']))

    # Process the nightly schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Nightly':
        c['schedulers'].append(Nightly(s_name,
                                       branch=scheduler['branch'],
                                       hour=scheduler['hour'],
                                       builderNames=scheduler['builders']))
Exemple #5
0
  def Update(self, c):
    for builder in self._builders:
      # Update the schedulers with the builder.
      schedulers = builder['schedulers']
      if schedulers:
        for scheduler in schedulers:
          self._schedulers[scheduler]['builders'].append(builder['name'])

      # Construct the category.
      categories = []
      if builder.get('category', None):
        categories.append(builder['category'])
      if builder.get('gatekeeper', None):
        categories.extend(builder['gatekeeper'].split('|'))
      category = '|'.join(categories)

      # Append the builder to the list.
      new_builder = {'name': builder['name'],
                     'factory': self._factories[builder['factory']],
                     'category': category,
                     'auto_reboot': builder['auto_reboot']}
      if builder['builddir']:
        new_builder['builddir'] = builder['builddir']
      c['builders'].append(new_builder)

    c['builders'].sort(key=lambda builder: builder['name'])

    # Process the main schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Scheduler':
        def filter_fn(change, builders):
          """Filters out if change.comments contains certain keywords.

          The change is filtered out if the commit message contains:
          * SKIP_BUILDBOT_SUBSTRING or
          * RUN_BUILDERS_REGEX when the scheduler does not contain any of the
            specified builders

          Args:
            change: An instance of changes.Change.
            builders: Sequence of strings. The builders that are run by this
              scheduler.

          Returns:
            If the change should be filtered out (i.e. not run by the buildbot
            code) then False is returned else True is returned.
          """
          if SKIP_BUILDBOT_SUBSTRING in change.comments:
            return False
          match_obj = RUN_BUILDERS_RE_COMPILED.search(change.comments)
          if builders and match_obj:
            for builder_to_run in match_obj.group(1).split(','):
              if builder_to_run.strip() in builders:
                break
            else:
              return False
          return True

        skia_change_filter = SkiaChangeFilter(
            builders=scheduler['builders'],
            branch=skia_vars.GetGlobalVariable('master_branch_name'),
            filter_fn=filter_fn)

        instance = Scheduler(name=s_name,
                             treeStableTimer=scheduler['treeStableTimer'],
                             builderNames=scheduler['builders'],
                             change_filter=skia_change_filter)
        c['schedulers'].append(instance)
        self._schedulers[s_name]['instance'] = instance

    # Process the periodic schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'PeriodicScheduler':
        instance = timed.Nightly(
            name=s_name,
            branch=skia_vars.GetGlobalVariable('master_branch_name'),
            builderNames=scheduler['builders'],
            minute=scheduler['minute'],
            hour=scheduler['hour'],
            dayOfMonth=scheduler['dayOfMonth'],
            month=scheduler['month'],
            dayOfWeek=scheduler['dayOfWeek'])
        c['schedulers'].append(instance)
        self._schedulers[s_name]['instance'] = instance

    # Process the Rietveld-based try schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'TryJobRietveld':
        pools = BuildersPools(s_name)
        pools[s_name].extend(scheduler['builders'])
        instance = try_job_rietveld.TryJobRietveld(
            name=s_name,
            pools=pools,
            last_good_urls={'skia': None},
            code_review_sites={'skia': config_private.CODE_REVIEW_SITE},
            project='skia')
        c['schedulers'].append(instance)
        self._schedulers[s_name]['instance'] = instance

    # Process the svn-based try schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'TryJobSubversion':
        pools = BuildersPools(s_name)
        pools[s_name].extend(scheduler['builders'])
        instance = try_job_svn.TryJobSubversion(
            name=s_name,
            svn_url=TRY_SVN_BASEURL,
            last_good_urls={'skia': None},
            code_review_sites={'skia': config_private.CODE_REVIEW_SITE},
            pools=pools)
        c['schedulers'].append(instance)
        self._schedulers[s_name]['instance'] = instance

    # Process the dependent schedulers.
    for s_name in self._schedulers:
      scheduler = self._schedulers[s_name]
      if scheduler['type'] == 'Dependent':
        instance = Dependent(
            s_name,
            self._schedulers[scheduler['parent']]['instance'],
            scheduler['builders'])
        c['schedulers'].append(instance)
        self._schedulers[s_name]['instance'] = instance
Exemple #6
0
 def __init__(self, name, upstream, builderNames, **kwargs):
     Dependent.__init__(self, name, upstream, builderNames)
     L10nMixin.__init__(self, **kwargs)