Esempio n. 1
0
def masterConfig(build_set_summary):
    c = {}
    from buildbot.config import BuilderConfig
    from buildbot.process.factory import BuildFactory
    from buildbot.plugins import steps, schedulers, reporters
    c['schedulers'] = [
        schedulers.AnyBranchScheduler(
            name="sched",
            builderNames=["testy"])
    ]
    f = BuildFactory()
    f.addStep(steps.ShellCommand(command='echo hello'))
    c['builders'] = [
        BuilderConfig(name="testy",
                      workernames=["local1"],
                      factory=f)
    ]

    formatter = MessageFormatter(template='This is a message.')
    formatter_worker = MessageFormatterMissingWorker(template='No worker.')

    if build_set_summary:
        generators_mail = [
            BuildSetStatusGenerator(mode='all'),
            WorkerMissingGenerator(workers='all'),
        ]
        generators_pushover = [
            BuildSetStatusGenerator(mode='all', message_formatter=formatter),
            WorkerMissingGenerator(workers=['local1'], message_formatter=formatter_worker),
        ]
    else:
        generators_mail = [
            BuildStatusGenerator(mode='all'),
            WorkerMissingGenerator(workers='all'),
        ]
        generators_pushover = [
            BuildStatusGenerator(mode='all', message_formatter=formatter),
            WorkerMissingGenerator(workers=['local1'], message_formatter=formatter_worker),
        ]

    c['services'] = [
        reporters.MailNotifier("*****@*****.**", generators=generators_mail),
        reporters.PushoverNotifier('1234', 'abcd', generators=generators_pushover)
    ]
    return c
Esempio n. 2
0
    def setup_generator(self,
                        results=SUCCESS,
                        message=None,
                        db_args=None,
                        **kwargs):
        if message is None:
            message = {"body": "body", "type": "text", "subject": "subject"}
        if db_args is None:
            db_args = {}

        build = yield self.insert_build_finished_get_props(results, **db_args)
        buildset = yield self.master.data.get(("buildsets", 98))

        g = BuildSetStatusGenerator(**kwargs)

        g.formatter = Mock(spec=g.formatter)
        g.formatter.format_message_for_build.return_value = message
        g.formatter.wantLogs = False
        g.formatter.wantSteps = False

        return (g, build, buildset)
Esempio n. 3
0
    def create_generators_from_old_args(self, mode, tags, builders, build_set_summary,
                                        message_formatter, subject, add_logs, add_patch, schedulers,
                                        branches, watched_workers,
                                        message_formatter_missing_worker):
        generators = []
        if build_set_summary:
            generators.append(BuildSetStatusGenerator(mode=mode, tags=tags, builders=builders,
                                                      schedulers=schedulers, branches=branches,
                                                      subject=subject, add_logs=add_logs,
                                                      add_patch=add_patch,
                                                      message_formatter=message_formatter))
        else:
            generators.append(BuildStatusGenerator(mode=mode, tags=tags, builders=builders,
                                                   schedulers=schedulers, branches=branches,
                                                   subject=subject, add_logs=add_logs,
                                                   add_patch=add_patch,
                                                   message_formatter=message_formatter))

        if watched_workers is not None and len(watched_workers) > 0:
            generators.append(
                WorkerMissingGenerator(workers=watched_workers,
                                       message_formatter=message_formatter_missing_worker))

        return generators
Esempio n. 4
0
        notify_events=[
            'exception',
            'problem',
            'recovery',
        ]
    ))

if hasattr(config, 'discord_reporter') and config.discord_reporter:
    from utils import discord
    from buildbot.reporters.generators.buildset import BuildSetStatusGenerator
    from buildbot.reporters.generators.build import BuildStatusGenerator
    services.append(discord.DiscordStatusPush(config.discord_reporter,
        generators=[
            BuildSetStatusGenerator(
                message_formatter=discord.DiscordFormatter(),
                # Only report builder aggregated in a buildset and not fetch or nightly
                tags=['build'],
                mode=("change", "exception")),
            BuildStatusGenerator(
                message_formatter=discord.DiscordFormatter(),
                # Report cleanup too
                tags=['cleanup'],
                mode=("change", "exception"))
    ]))

if hasattr(config, 'enable_list_snapshots') and config.enable_list_snapshots:
    serve_snapshots = hasattr(config, 'serve_snapshots') and config.serve_snapshots
    import builds, platforms
    from utils import list_snapshots
    from utils import scummsteps
    www['plugins']['wsgi_dashboards'] = [{
Esempio n. 5
0
 def _create_default_generators(self):
     formatter = DiscordFormatter()
     return [BuildSetStatusGenerator(message_formatter=formatter)]