def main(): """ Launch local build slave instances """ # Gather command-line arguments. ParseArgs(sys.argv[1:]) # This is needed on Windows bots syncing internal code. if os.name == 'nt': os.environ['HOME'] = os.path.join('c:\\', 'Users', 'chrome-bot') # Sync the buildbot code. subprocess.check_call([GCLIENT, 'sync', '--force', '-j1']) # Set up launch-on-reboot. launch_on_reboot = os.path.join(buildbot_path, 'scripts', 'launch_on_reboot.py') subprocess.check_call(['python', launch_on_reboot]) # Obtain configuration information about this build slave host machine. slave_host = slave_hosts_cfg.get_slave_host_config(socket.gethostname()) slaves = slave_host.slaves print 'Attempting to launch build slaves:' for slavename, _, _ in slaves: print ' %s' % slavename # Launch the build slaves for slavename, slave_num, is_internal in slaves: RunSlave(slavename, slave_num, is_internal) # Set up cron jobs. setup_cronjob()
def setup_launch_on_reboot(): """Set up launch-on-reboot as appropriate for this platform.""" # Obtain the slave_host configuration for this buildslave. We're mostly # interested in path_to_buildbot, which we'll use to determine skia_repo_dir, # and launch_script, which is the script which should be run at boot. cfg = slave_hosts_cfg.get_slave_host_config(socket.gethostname()) # Chop off the last element of path_to_buildbot, since that's the buildbot # directory itself. if len(cfg.path_to_buildbot) <= 1: skia_repo_dir = '' else: if ':' in cfg.path_to_buildbot[0]: # This is an issue with split/joining paths on Windows. If there's a drive # letter in the path which gets split, we end up with a list whose first # element has 'C:', for example. os.path.join('C:', 'somedir') does not # add a '\'. Instead, we get 'C:somedir'. So we add the backslash here. cfg.path_to_buildbot[0] += os.path.sep skia_repo_dir = os.path.join(*cfg.path_to_buildbot[:-1]) if cfg.path_to_buildbot[0] == '': # If path_to_buildbot begins with '/', path_to_buildbot.split(os.path.sep) # will return a list with an empty string as the first element. # Unfortunately, os.path.join does not recreate the leading '/', so we have # to do it here. skia_repo_dir = os.path.sep + skia_repo_dir else: # Otherwise, this is a relative path skia_repo_dir = os.path.join(os.path.expanduser('~'), skia_repo_dir) # Use the skia_repo_dir to construct the path to the launch script. launch_script = os.path.join(skia_repo_dir, 'buildbot', *cfg.launch_script) # Now, call the platform-specific setup function. if sys.platform.startswith('linux'): _setup_launch_on_reboot_linux(launch_script=launch_script, skia_repo_dir=skia_repo_dir) elif sys.platform == 'darwin': _setup_launch_on_reboot_mac(launch_script=launch_script, skia_repo_dir=skia_repo_dir) elif sys.platform == 'win32': _setup_launch_on_reboot_win32(launch_script=launch_script, skia_repo_dir=skia_repo_dir) else: raise NotImplementedError( 'No defined way to set up launch-on-reboot for %s' % sys.platform)
def main(): """ Launch local build slave instances """ # Gather command-line arguments. ParseArgs(sys.argv[1:]) # Sync the buildbot code. subprocess.check_call([GCLIENT, 'sync', '--force', '-j1']) # Obtain configuration information about this build slave host machine. slave_host = slave_hosts_cfg.get_slave_host_config(socket.gethostname()) slaves = slave_host.slaves copies = slave_host.copies print 'Attempting to launch build slaves:' for slavename, _ in slaves: print ' %s' % slavename # Launch the build slaves for slavename, _ in slaves: RunSlave(slavename, copies)
def main(): """ Launch local build slave instances """ # Gather command-line arguments. ParseArgs(sys.argv[1:]) # This is needed on Windows bots syncing internal code. if os.name == 'nt': os.environ['HOME'] = os.path.join('c:\\', 'Users', 'chrome-bot') # Sync the buildbot code. subprocess.check_call([GCLIENT, 'sync', '--force', '-j1']) # Obtain configuration information about this build slave host machine. slave_host = slave_hosts_cfg.get_slave_host_config(socket.gethostname()) slaves = slave_host.slaves print 'Attempting to launch build slaves:' for slavename, _, connects_to_new_master in slaves: print ' %s%s' % (slavename, (' (new master)' if connects_to_new_master else '')) # Launch the build slaves for slavename, slave_num, connects_to_new_master in slaves: RunSlave(slavename, slave_num, connects_to_new_master)
def find_slaves(host): """Get the list of slaves which run on the given host.""" slaves = slave_hosts_cfg.get_slave_host_config(host).slaves return [s[0] for s in slaves]