def as_testing(self, source): builder_configs = [b.as_config() for b in self.builders] buildbot_config_dict = { 'buildbotNetUsageData': None, 'workers': self.workers, 'builders': builder_configs, 'schedulers': self.schedulers, 'db': {'db_url': 'sqlite://'}, 'protocols': {'pb': {'port': 'tcp:0:interface=127.0.0.1'}} } return BuildbotMasterConfig.loadFromDict(buildbot_config_dict, filename=source)
def as_buildbot(self, source): """Returns with the buildbot compatible buildmaster configuration""" if self.change_hook is None: hook_dialect_config = {} else: hook_dialect_config = self.change_hook._as_hook_dialect_config() buildbot_config_dict = { 'buildbotNetUsageData': None, 'title': self.title, 'titleURL': self.url, 'buildbotURL': self.url, 'workers': self.workers, 'builders': self.builders, 'schedulers': self.schedulers, 'services': self.reporters, 'change_source': self.pollers, 'secretsProviders': self.secret_providers or [], 'protocols': { 'pb': { 'port': self.worker_port } }, 'db': { 'db_url': self.database_url }, 'www': { 'port': self.webui_port, 'change_hook_dialects': hook_dialect_config, 'plugins': { 'waterfall_view': {}, 'console_view': {}, 'grid_view': {} } } } # buildbot raises errors for None or empty dict values so only set of # they are passed if self.auth is not None: buildbot_config_dict['www']['auth'] = self.auth if self.authz is not None: buildbot_config_dict['www']['authz'] = self.authz return BuildbotMasterConfig.loadFromDict(buildbot_config_dict, filename=source)
def loadConfig(self): return MasterConfig.loadFromDict(self.config_dict, '<dict>')
def __init__(self, BuildmasterConfig, basedir, name="config"): self.db_url = MasterConfig.getDbUrlFromConfig(BuildmasterConfig, throwErrors=False) self.basedir = basedir self.name = name
def expectNoConfigError(self): config = MasterConfig() config.loadFromDict(self.config_dict, "test")
def __init__(self, BuildmasterConfig, basedir, name="config"): self.db_url = MasterConfig.getDbUrlFromConfig( BuildmasterConfig, throwErrors=False) self.basedir = basedir self.name = name
def setUp(self): from buildbot.config import MasterConfig master = MasterConfig() self.regex_branches = master.regex_branches self.tag_as_branch_regex = master.tag_as_branch_regex
def create_master_config(config_dict): try: master_config = MasterConfig() filename = None master_config.load_global(filename, config_dict) master_config.load_validation(filename, config_dict) master_config.load_db(filename, config_dict) master_config.load_mq(filename, config_dict) master_config.load_metrics(filename, config_dict) master_config.load_caches(filename, config_dict) master_config.load_schedulers(filename, config_dict) master_config.load_builders(filename, config_dict) master_config.load_workers(filename, config_dict) master_config.load_change_sources(filename, config_dict) master_config.load_status(filename, config_dict) master_config.load_user_managers(filename, config_dict) master_config.load_www(filename, config_dict) master_config.load_services(filename, config_dict) # run some sanity checks master_config.check_single_master() master_config.check_schedulers() master_config.check_locks() master_config.check_builders() master_config.check_status() master_config.check_horizons() master_config.check_ports() except Exception as e: raise Exception("Could not reconfigure Buildbot: " + str(e)) return master_config