예제 #1
0
def SetupMaster(ActiveMaster):
    # Buildmaster config dict.
    c = {}

    config.DatabaseSetup(c, require_dbconfig=ActiveMaster.is_production_host)

    ####### CHANGESOURCES

    # Polls config.Master.trunk_url for changes
    poller = GitilesPoller(
        repo_url=ActiveMaster.repo_url,
        branches=['master'],
        pollInterval=10,
        revlinktmpl='https://skia.googlesource.com/skia/+/%s')

    c['change_source'] = [poller]

    ####### SLAVES

    # Load the slave list. We need some information from it in order to
    # produce the builders.
    slaves = slaves_list.SlavesList('slaves.cfg', ActiveMaster.project_name)

    ####### BUILDERS

    # Load the builders list.
    builders = chromium_utils.ParsePythonCfg('builders.cfg')['builders']

    # Configure the Builders and Schedulers.
    SetupBuildersAndSchedulers(c=c,
                               builders=builders,
                               slaves=slaves,
                               ActiveMaster=ActiveMaster)

    ####### BUILDSLAVES

    # The 'slaves' list defines the set of allowable buildslaves. List all the
    # slaves registered to a builder. Remove dupes.
    c['slaves'] = master_utils.AutoSetupSlaves(c['builders'],
                                               config.Master.GetBotPassword())
    master_utils.VerifySetup(c, slaves)

    ####### STATUS TARGETS

    c['buildbotURL'] = ActiveMaster.buildbot_url

    # Adds common status and tools to this master.
    master_utils.AutoSetupMaster(
        c,
        ActiveMaster,
        public_html='../../../build/masters/master.client.skia/public_html',
        templates=[
            '../../../build/masters/master.client.skia/templates',
            '../../../build/masters/master.chromium/templates'
        ],
        tagComparator=poller.comparator,
        enable_http_status_push=ActiveMaster.is_production_host,
        order_console_by_time=True,
        console_repo_filter=ActiveMaster.repo_url,
        console_builder_filter=lambda b: not builder_name_schema.IsTrybot(b))

    with status_json.JsonStatusHelper() as json_helper:
        json_helper.putChild('trybots', status_json.TryBuildersJsonResource)

    if ActiveMaster.is_production_host:
        # Build result emails.
        c['status'].append(
            skia_notifier.SkiaMailNotifier(
                fromaddr=ActiveMaster.from_address,
                mode='change',
                relayhost=config.Master.smtp,
                lookup=master_utils.UsersAreEmails()))

        # Try job result emails.
        c['status'].append(
            skia_notifier.SkiaTryMailNotifier(
                fromaddr=ActiveMaster.from_address,
                subject="try %(result)s for %(reason)s @ r%(revision)s",
                mode='all',
                relayhost=config.Master.smtp,
                lookup=master_utils.UsersAreEmails()))

        # Rietveld status push.
        c['status'].append(
            TryServerHttpStatusPush(serverUrl=ActiveMaster.code_review_site))

    return c
예제 #2
0
def SetupMaster(ActiveMaster):
    # Buildmaster config dict.
    c = {}

    config.DatabaseSetup(c)

    ####### CHANGESOURCES

    # Polls config.Master.trunk_url for changes
    poller = GitilesPoller(
        repo_url=ActiveMaster.repo_url,
        branches=[POLLING_BRANCH],
        pollInterval=10,
        revlinktmpl='https://skia.googlesource.com/skia/+/%s')

    c['change_source'] = [poller]

    ####### SLAVES

    # Load the slave list. We need some information from it in order to
    # produce the builders.
    slaves = slaves_list.SlavesList('slaves.cfg', ActiveMaster.project_name)

    ####### BUILDERS

    # Load the builders list.
    builders = chromium_utils.ParsePythonCfg('builders.cfg')['builders']

    # Configure the Builders and Schedulers.
    SetupBuildersAndSchedulers(c=c,
                               builders=builders,
                               slaves=slaves,
                               ActiveMaster=ActiveMaster)

    ####### BUILDSLAVES

    # The 'slaves' list defines the set of allowable buildslaves. List all the
    # slaves registered to a builder. Remove dupes.
    c['slaves'] = master_utils.AutoSetupSlaves(c['builders'],
                                               config.Master.GetBotPassword())
    master_utils.VerifySetup(c, slaves)

    ####### STATUS TARGETS

    c['buildbotURL'] = ActiveMaster.buildbot_url

    # Adds common status and tools to this master.
    master_utils.AutoSetupMaster(
        c,
        ActiveMaster,
        public_html='../../../build/masters/master.client.skia/public_html',
        templates=[
            '../../../build/masters/master.client.skia/templates',
            '../../../build/masters/master.chromium/templates'
        ],
        tagComparator=poller.comparator,
        enable_http_status_push=ActiveMaster.is_production_host,
        order_console_by_time=True,
        console_repo_filter=ActiveMaster.repo_url,
        console_builder_filter=lambda b: not builder_name_schema.IsTrybot(b))

    with status_json.JsonStatusHelper() as json_helper:
        json_helper.putChild('trybots', status_json.TryBuildersJsonResource)

    if (ActiveMaster.is_production_host
            and ActiveMaster.project_name != 'SkiaInternal'):
        # Build result emails.
        c['status'].append(status_logger.StatusEventLogger())
        c['status'].append(
            skia_notifier.SkiaMailNotifier(
                fromaddr=ActiveMaster.from_address,
                mode='change',
                relayhost=config.Master.smtp,
                lookup=master_utils.UsersAreEmails()))

        # Try job result emails.
        c['status'].append(
            skia_notifier.SkiaTryMailNotifier(
                fromaddr=ActiveMaster.from_address,
                subject="try %(result)s for %(reason)s @ r%(revision)s",
                mode='all',
                relayhost=config.Master.smtp,
                lookup=master_utils.UsersAreEmails()))

        # Push status updates to GrandCentral.
        c['status'].append(
            HttpStatusPush(serverUrl='https://grandcentral.skia.org/buildbot'))

    c['mergeRequests'] = CanMergeBuildRequests

    ###### LOGS

    # Skia bots have been known to have run away builds continously dumping to
    # stdout and creating ~100GB logs. See crbug.com/589654 for context.
    c['logMaxSize'] = 1024 * 1024 * 100  # 100MB
    c['logMaxTailSize'] = 1024 * 32  # 32KB

    return c