Ejemplo n.º 1
0
    def testInternalRepoCheckout(self):
        """Test we detect internal checkouts properly."""
        tests = [
            'https://chrome-internal.googlesource.com/chromeos/manifest-internal',
            '[email protected]:39291/bla/manifest-internal.git',
        ]

        for test in tests:
            self.rc.SetDefaultCmdResult(output=test)
            self.assertTrue(repository.IsInternalRepoCheckout('.'))
Ejemplo n.º 2
0
    def __init__(self, options, bots, local_patches):
        """Construct the object.

    Args:
      options: The parsed options passed into cbuildbot.
      bots: A list of configs to run tryjobs for.
      local_patches: A list of LocalPatch objects.
    """
        self.options = options
        self.use_buildbucket = options.use_buildbucket
        self.user = getpass.getuser()
        self.repo_cache = cache.DiskCache(self.options.cache_dir)
        cwd = os.path.dirname(os.path.realpath(__file__))
        self.user_email = git.GetProjectUserEmail(cwd)
        logging.info('Using email:%s', self.user_email)
        # Name of the job that appears on the waterfall.
        patch_list = options.gerrit_patches + options.local_patches
        self.name = options.remote_description
        if self.name is None:
            self.name = ''
            if options.branch != 'master':
                self.name = '[%s] ' % options.branch

            self.name += ','.join(patch_list[:self.MAX_PATCHES_IN_DESCRIPTION])
            if len(patch_list) > self.MAX_PATCHES_IN_DESCRIPTION:
                remaining_patches = len(
                    patch_list) - self.MAX_PATCHES_IN_DESCRIPTION
                self.name += '... (%d more CLs)' % (remaining_patches, )

        self.bots = bots[:]
        self.slaves_request = options.slaves
        self.description = ('name: %s\n patches: %s\nbots: %s' %
                            (self.name, patch_list, self.bots))
        self.extra_args = options.pass_through_args
        if '--buildbot' not in self.extra_args:
            self.extra_args.append('--remote-trybot')

        self.extra_args.append('--remote-version=%s' %
                               (self.TRYJOB_FORMAT_VERSION, ))
        self.local_patches = local_patches
        self.repo_url = self.EXTERNAL_URL
        self.cache_key = ('trybot', )
        self.manifest = None
        if repository.IsARepoRoot(options.sourceroot):
            self.manifest = git.ManifestCheckout.Cached(options.sourceroot)
            if repository.IsInternalRepoCheckout(options.sourceroot):
                self.repo_url = self.INTERNAL_URL
                self.cache_key = ('trybot-internal', )