示例#1
0
def Update(config, active_master, c):
    factory = BuildFactory()
    factory_commands = commands.FactoryCommands(factory)
    factory_commands.AddUpdateScriptStep()
    # pylint: disable=W0212
    gitzip_exe = os.path.join(factory_commands._script_dir, 'gitzip.py')
    cmd = [
        'python', gitzip_exe, '--workdir', '.', '--url',
        '%schromium/src.git' % config.Master.git_server_url, '--gs_bucket',
        'gs://chromium-git-bundles', '--gs_acl', 'public-read', '--timeout',
        '%d' % (60 * 60), '--stayalive', '200', '--verbose'
    ]
    factory.addStep(shell.ShellCommand,
                    name='gitzip',
                    description='gitzip',
                    timeout=7200,
                    workdir='',
                    command=cmd)

    builders = c.setdefault('builders', [])
    builders.append({
        'name': 'Chromium Git Packager',
        'builddir': 'chromium-git-packager',
        'factory': factory,
        'auto_reboot': False
    })

    schedulers = c.setdefault('schedulers', [])
    schedulers.append(
        Nightly(name='gitzip_nightly',
                branch=None,
                builderNames=['Chromium Git Packager'],
                hour=2,
                minute=40))
示例#2
0
def Update(config, active_master, c):
  factory = BuildFactory()
  factory_commands = commands.FactoryCommands(factory)
  factory_commands.AddUpdateScriptStep()
  # pylint: disable=W0212
  gitzip_exe = os.path.join(factory_commands._script_dir, 'gitzip.py')
  cmd = ['python', gitzip_exe,
         '--workdir', '.',
         '--url', '%schromium/src.git' % config.Master.git_server_url,
         '--gs_bucket', 'gs://chromium-git-bundles',
         '--gs_acl', 'public-read',
         '--timeout', '%d' % (60*60),
         '--stayalive', '200',
         '--verbose']
  factory.addStep(shell.ShellCommand, name='gitzip', description='gitzip',
                  timeout=7200, workdir='', command=cmd)

  builders = c.setdefault('builders', [])
  builders.append({
      'name': 'Chromium Git Packager',
      'builddir': 'chromium-git-packager',
      'factory': factory,
      'auto_reboot': False})

  schedulers = c.setdefault('schedulers', [])
  schedulers.append(Nightly(name='gitzip_nightly',
                            branch=None,
                            builderNames=['Chromium Git Packager'],
                            hour=2,
                            minute=40))
示例#3
0
    def BaseFactory(self, recipe, factory_properties=None, triggers=None, timeout=1200, max_time=None):
        """The primary input for the factory is the |recipe|, which specifies the
    name of a recipe file to search for. The recipe file will fill in the rest
    of the |factory_properties|. This setup allows for major changes to factory
    properties to occur on slave-side without master restarts.

    NOTE: Please be very discerning with what |factory_properties| you pass to
    this method. Ideally, you will pass none, and that will be sufficient in the
    vast majority of cases. Think very carefully before adding any
    |factory_properties| here, as changing them will require a master restart.

    |timeout| refers to the maximum number of seconds a step should be allowed
    to run without output. After no output for |timeout| seconds, the step is
    forcibly killed.

    |max_time| refers to the maximum number of seconds a step should be allowed
    to run, regardless of output. After |max_time| seconds, the step is forcibly
    killed.
    """
        factory_properties = factory_properties or {}
        factory_properties.update({"recipe": recipe})
        self._factory_properties = factory_properties
        factory = BuildFactory()
        cmd_obj = annotator_commands.AnnotatorCommands(factory)
        cmd_obj.AddAnnotatedScript(factory_properties, timeout=timeout, max_time=max_time)

        for t in triggers or []:
            factory.addStep(commands.CreateTriggerStep(t, trigger_copy_properties=["swarm_hashes"]))

        return factory
示例#4
0
  def BaseFactory(self, recipe, factory_properties=None, triggers=None,
                  timeout=1200, max_time=None):
    """The primary input for the factory is the |recipe|, which specifies the
    name of a recipe file to search for. The recipe file will fill in the rest
    of the |factory_properties|. This setup allows for major changes to factory
    properties to occur on slave-side without master restarts.

    NOTE: Please be very discerning with what |factory_properties| you pass to
    this method. Ideally, you will pass none, and that will be sufficient in the
    vast majority of cases. Think very carefully before adding any
    |factory_properties| here, as changing them will require a master restart.

    |timeout| refers to the maximum number of seconds a step should be allowed
    to run without output. After no output for |timeout| seconds, the step is
    forcibly killed.

    |max_time| refers to the maximum number of seconds a step should be allowed
    to run, regardless of output. After |max_time| seconds, the step is forcibly
    killed.
    """
    factory_properties = factory_properties or {}
    factory_properties.update({'recipe': recipe})
    self._factory_properties = factory_properties
    factory = BuildFactory()
    cmd_obj = annotator_commands.AnnotatorCommands(factory)
    cmd_obj.AddAnnotatedScript(
      factory_properties, timeout=timeout, max_time=max_time)

    for t in (triggers or []):
      factory.addStep(commands.CreateTriggerStep(
          t, trigger_copy_properties=['swarm_hashes']))

    return factory
示例#5
0
  def BaseFactory(self, recipe=None, factory_properties=None, triggers=None,
                  timeout=2400, max_time=None):
    """The primary input for the factory is the |recipe|, which specifies the
    name of a recipe file to search for. The recipe file will fill in the rest
    of the |factory_properties|. This setup allows for major changes to factory
    properties to occur on slave-side without master restarts.

    NOTE: Please be very discerning with what |factory_properties| you pass to
    this method. Ideally, you will pass none, and that will be sufficient in the
    vast majority of cases. Think very carefully before adding any
    |factory_properties| here, as changing them will require a master restart.

    |recipe| is the name of the recipe to pass to annotated_run.  If omitted,
    annotated_run will attempt to look up the recipe from builders.pyl in the
    master.

    |timeout| refers to the maximum number of seconds a build should be allowed
    to run without output. After no output for |timeout| seconds, the build is
    forcibly killed.

    |max_time| refers to the maximum number of seconds a build should be allowed
    to run, regardless of output. After |max_time| seconds, the build is
    forcibly killed.
    """
    factory_properties = factory_properties or {}
    if recipe:
      factory_properties.update({'recipe': recipe})
    self._factory_properties = factory_properties
    factory = BuildFactory(build_inherit_factory_properties=False)
    factory.properties.update(self._factory_properties, 'AnnotatorFactory')
    cmd_obj = annotator_commands.AnnotatorCommands(
        factory, active_master=self.active_master)

    runner = cmd_obj.PathJoin(cmd_obj.script_dir, 'annotated_run.py')
    cmd = [cmd_obj.python, '-u', runner, '--use-factory-properties-from-disk']
    cmd = cmd_obj.AddB64GzBuildProperties(cmd)

    cmd_obj.AddAnnotatedScript(cmd, timeout=timeout, max_time=max_time)

    for t in triggers or []:
      factory.addStep(commands.CreateTriggerStep(
          t, trigger_copy_properties=['swarm_hashes']))

    return factory
示例#6
0
  def BaseFactory(self, recipe=None, factory_properties=None, triggers=None,
                  timeout=2400, max_time=None):
    """The primary input for the factory is the |recipe|, which specifies the
    name of a recipe file to search for. The recipe file will fill in the rest
    of the |factory_properties|. This setup allows for major changes to factory
    properties to occur on slave-side without master restarts.

    NOTE: Please be very discerning with what |factory_properties| you pass to
    this method. Ideally, you will pass none, and that will be sufficient in the
    vast majority of cases. Think very carefully before adding any
    |factory_properties| here, as changing them will require a master restart.

    |recipe| is the name of the recipe to pass to annotated_run.  If omitted,
    annotated_run will attempt to look up the recipe from builders.pyl in the
    master.

    |timeout| refers to the maximum number of seconds a build should be allowed
    to run without output. After no output for |timeout| seconds, the build is
    forcibly killed.

    |max_time| refers to the maximum number of seconds a build should be allowed
    to run, regardless of output. After |max_time| seconds, the build is
    forcibly killed.
    """
    factory_properties = factory_properties or {}
    if recipe:
      factory_properties.update({'recipe': recipe})
    self._factory_properties = factory_properties
    factory = BuildFactory(build_inherit_factory_properties=False)
    factory.properties.update(self._factory_properties, 'AnnotatorFactory')
    cmd_obj = annotator_commands.AnnotatorCommands(
        factory, active_master=self.active_master)
    cmd_obj.AddAnnotatedScript(timeout=timeout, max_time=max_time)

    for t in triggers or []:
      factory.addStep(commands.CreateTriggerStep(
          t, trigger_copy_properties=['swarm_hashes']))

    return factory
def RemoteRunFactory(active_master,
                     repository,
                     recipe,
                     revision=None,
                     factory_properties=None,
                     timeout=2400,
                     max_time=None,
                     triggers=None,
                     use_gitiles=False):
    """Returns buildbot build factory which runs recipes using recipe engine's
  remote_run command.

  |active_master| is config_bootstrap.Master's subclass from master's
  master_site_config.py .

  |repository| is the URL of repository containing recipe to run.

  |recipe| is the name of the recipe to run.

  |revision| is the revision to use for repo checkout (by default we use latest
  revision). Must be a commit hash or a fully-qualified ref.

  |factory_properties| is a dictionary of default build properties.

  |timeout| refers to the maximum number of seconds a build should be allowed
  to run without output. After no output for |timeout| seconds, the build is
  forcibly killed.

  |max_time| refers to the maximum number of seconds a build should be allowed
  to run, regardless of output. After |max_time| seconds, the build is
  forcibly killed.

  |triggers| is a list of builders on the same master to trigger
  after the build.

  |use_gitiles| enables a Gitiles-specific way to fetch the repo; it's more
  efficient for large repos.
  """
    revision = revision or 'refs/heads/master'
    if isinstance(revision, basestring):
        assert re.match('^([a-z0-9]{40}|refs/.+)$', revision)

    factory_properties = factory_properties or {}

    # This is useful e.g. for botmap updater to easily extract info about builder.
    factory_properties.update({
        'recipe': recipe,
        'recipe_repository': repository,
        'use_gitiles': use_gitiles,
    })

    factory = BuildFactory(build_inherit_factory_properties=False)
    factory.properties.update(factory_properties, 'RemoteRunFactory')
    cmd_obj = annotator_commands.AnnotatorCommands(factory,
                                                   active_master=active_master)

    runner = cmd_obj.PathJoin(cmd_obj.script_dir, 'remote_run.py')
    cmd = [
        cmd_obj.python,
        '-u',
        runner,
        '--repository',
        repository,
        '--revision',
        revision,
        '--recipe',
        recipe,
    ]
    if use_gitiles:
        cmd.append('--use-gitiles')
    cmd = cmd_obj.AddB64GzBuildProperties(cmd)
    cmd = cmd_obj.AddB64GzFactoryProperties(factory_properties, cmd)

    cmd_obj.AddAnnotatedScript(cmd, timeout=timeout, max_time=max_time)

    for t in triggers or []:
        factory.addStep(
            commands.CreateTriggerStep(
                t, trigger_copy_properties=['swarm_hashes']))

    return factory
示例#8
0
def RemoteRunFactory(active_master,
                     repository,
                     recipe,
                     revision='origin/master',
                     factory_properties=None,
                     timeout=2400,
                     max_time=None,
                     triggers=None):
    """Returns buildbot build factory which runs recipes using recipe engine's
  remote_run command.

  |active_master| is config_bootstrap.Master's subclass from master's
  master_site_config.py .

  |repository| is the URL of repository containing recipe to run.

  |recipe| is the name of the recipe to run.

  |revision| is the revision to use for repo checkout (by default we use latest
  revision).

  |factory_properties| is a dictionary of default build properties.

  |timeout| refers to the maximum number of seconds a build should be allowed
  to run without output. After no output for |timeout| seconds, the build is
  forcibly killed.

  |max_time| refers to the maximum number of seconds a build should be allowed
  to run, regardless of output. After |max_time| seconds, the build is
  forcibly killed.

  |triggers| is a list of builders on the same master to trigger
  after the build.
  """
    factory_properties = factory_properties or {}

    # This is useful e.g. for botmap updater to easily extract info about builder.
    factory_properties.update({'recipe': recipe})

    factory = BuildFactory(build_inherit_factory_properties=False)
    factory.properties.update(factory_properties, 'RemoteRunFactory')
    cmd_obj = annotator_commands.AnnotatorCommands(factory,
                                                   active_master=active_master)

    runner = cmd_obj.PathJoin(cmd_obj.script_dir, 'remote_run.py')
    cmd = [
        cmd_obj.python,
        '-u',
        runner,
        '--repository',
        repository,
        '--revision',
        revision,
        '--recipe',
        recipe,
    ]
    cmd = cmd_obj.AddB64GzBuildProperties(cmd)
    cmd = cmd_obj.AddB64GzFactoryProperties(factory_properties, cmd)

    cmd_obj.AddAnnotatedScript(cmd, timeout=timeout, max_time=max_time)

    for t in triggers or []:
        factory.addStep(
            commands.CreateTriggerStep(
                t, trigger_copy_properties=['swarm_hashes']))

    return factory