How to use the buildbot.config function in buildbot

To help you get started, we’ve selected a few buildbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buildbot / buildbot / master / buildbot / master.py View on Github external
def reconfigService(self, new_config):
        if self.configured_db_url is None:
            self.configured_db_url = new_config.db['db_url']
        elif (self.configured_db_url != new_config.db['db_url']):
            config.error(
                "Cannot change c['db']['db_url'] after the master has started",
            )

        # adjust the db poller
        if (self.configured_poll_interval
                != new_config.db['db_poll_interval']):
            if self.db_loop:
                self.db_loop.stop()
                self.db_loop = None
            self.configured_poll_interval = new_config.db['db_poll_interval']
            if self.configured_poll_interval:
                self.db_loop = task.LoopingCall(self.pollDatabase)
                self.db_loop.start(self.configured_poll_interval, now=False)

        return config.ReconfigurableServiceMixin.reconfigService(self,
                                            new_config)
github buildbot / buildbot / master / buildbot / worker / hyper.py View on Github external
def checkConfig(self, name, password, hyper_host,
                    hyper_accesskey, hyper_secretkey, image, hyper_size="s3", masterFQDN=None, **kwargs):

        DockerBaseWorker.checkConfig(
            self, name, password, image=image, masterFQDN=masterFQDN, **kwargs)

        if not Hyper:
            config.error("The python modules 'docker>=2.0' and 'hyper_sh' are needed to use a"
                         " HyperLatentWorker")

        if not IRenderable.providedBy(hyper_size) and hyper_size not in self.ALLOWED_SIZES:
            config.error("Size is not valid {!r} vs {!r}".format(
                hyper_size, self.ALLOWED_SIZES))
github buildbot / buildbot / master / buildbot / status / web / baseweb.py View on Github external
"""

        service.MultiService.__init__(self)
        if type(http_port) is int:
            http_port = "tcp:%d" % http_port
        self.http_port = http_port
        if distrib_port is not None:
            if type(distrib_port) is int:
                distrib_port = "tcp:%d" % distrib_port
            if distrib_port[0] in "/~.": # pathnames
                distrib_port = "unix:%s" % distrib_port
        self.distrib_port = distrib_port
        self.num_events = num_events
        if num_events_max:
            if num_events_max < num_events:
                config.error(
                    "num_events_max must be greater than num_events")
            self.num_events_max = num_events_max
        self.public_html = public_html

        # make up an authz if allowForce was given
        if authz:
            if allowForce is not None:
                config.error(
                    "cannot use both allowForce and authz parameters")
            if auth:
                config.error(
                    "cannot use both auth and authz parameters (pass " +
                    "auth as an Authz parameter)")
        else:
            # invent an authz
            if allowForce and auth:
github buildbot / buildbot / master / buildbot / steps / cmake.py View on Github external
def __init__(self, path=None, generator=None, definitions=None,
                 options=None, cmake=DEFAULT_CMAKE, **kwargs):

        self.path = path
        self.generator = generator

        if not (definitions is None or isinstance(definitions, dict)
                or IRenderable.providedBy(definitions)):
            config.error('definitions must be a dictionary or implement IRenderable')
        self.definitions = definitions

        if not (options is None or isinstance(options, (list, tuple))
                or IRenderable.providedBy(options)):
            config.error('options must be a list, a tuple or implement IRenderable')
        self.options = options

        self.cmake = cmake
        kwargs = self.setupShellMixin(kwargs, prohibitArgs=['command'])
        super(CMake, self).__init__(**kwargs)
github buildbot / buildbot / master / buildbot / changes / gitpoller.py View on Github external
name = repourl

        super().__init__(name=name,
                         pollInterval=pollInterval,
                         pollAtLaunch=pollAtLaunch,
                         sshPrivateKey=sshPrivateKey,
                         sshHostKey=sshHostKey,
                         sshKnownHosts=sshKnownHosts)

        if project is None:
            project = ''

        if only_tags and (branch or branches):
            config.error("GitPoller: can't specify only_tags and branch/branches")
        if branch and branches:
            config.error("GitPoller: can't specify both branch and branches")
        elif branch:
            branches = [branch]
        elif not branches:
            if only_tags:
                branches = lambda ref: ref.startswith('refs/tags/')  # noqa: E731
            else:
                branches = ['master']

        self.repourl = repourl
        self.branches = branches
        self.encoding = encoding
        self.buildPushesWithNoCommits = buildPushesWithNoCommits
        self.gitbin = gitbin
        self.workdir = workdir
        self.usetimestamps = usetimestamps
        self.category = category if callable(
github buildbot / buildbot / master / buildbot / steps / shellsequence.py View on Github external
def validateAttributes(self):
        # only make the check if we have a list
        if not isinstance(self.command, (string_types, list)):
            config.error("%s is an invalid command, "
                         "it must be a string or a list" % (self.command,))
        if isinstance(self.command, list):
            if not all([isinstance(x, string_types) for x in self.command]):
                config.error("%s must only have strings in it" %
                             (self.command,))
        runConfParams = [(p_attr, getattr(self, p_attr))
                         for p_attr in self.resultConfig]
        not_bool = [(p_attr, p_val) for (p_attr, p_val) in runConfParams if not isinstance(p_val,
                                                                                           bool)]
        if not_bool:
            config.error("%r must be booleans" % (not_bool,))
github buildbot / buildbot / master / buildbot / steps / shell.py View on Github external
def __init__(self, property=None, extract_fn=None, strip=True, **kwargs):
        self.property = property
        self.extract_fn = extract_fn
        self.strip = strip

        if not ((property is not None) ^ (extract_fn is not None)):
            config.error(
                "Exactly one of property and extract_fn must be set")

        ShellCommand.__init__(self, **kwargs)

        if self.extract_fn:
            self.observer = logobserver.BufferLogObserver(wantStdout=True,
                                                          wantStderr=True)
            self.addLogObserver('stdio', self.observer)

        self.property_changes = {}
github buildbot / buildbot / master / buildbot / steps / python.py View on Github external
def __init__(self, sphinx_sourcedir='.', sphinx_builddir=None,
                 sphinx_builder=None, sphinx='sphinx-build', tags=[],
                 defines={}, mode='incremental', **kwargs):

        if sphinx_builddir is None:
            # Who the heck is not interested in the built doc ?
            config.error("Sphinx argument sphinx_builddir is required")

        if mode not in ('incremental', 'full'):
            config.error("Sphinx argument mode has to be 'incremental' or" +
                         "'full' is required")

        self.warnings = 0
        self.success = False
        ShellCommand.__init__(self, **kwargs)

        # build the command
        command = [sphinx]
        if sphinx_builder is not None:
            command.extend(['-b', sphinx_builder])

        for tag in tags:
            command.extend(['-t', tag])

        for key in sorted(defines):
            if defines[key] is None:
github buildbot / buildbot / master / buildbot / secrets / providers / passwordstore.py View on Github external
def checkPassDirectoryIsAvailableAndReadable(self, dirname):
        if not os.access(dirname, os.F_OK):
            config.error("directory %s does not exist" % dirname)
github buildbot / buildbot / master / buildbot / changes / gitpoller.py View on Github external
if name is None:
            name = repourl

        super().__init__(name=name,
                         pollInterval=pollInterval,
                         pollAtLaunch=pollAtLaunch,
                         sshPrivateKey=sshPrivateKey,
                         sshHostKey=sshHostKey,
                         sshKnownHosts=sshKnownHosts)

        if project is None:
            project = ''

        if only_tags and (branch or branches):
            config.error("GitPoller: can't specify only_tags and branch/branches")
        if branch and branches:
            config.error("GitPoller: can't specify both branch and branches")
        elif branch:
            branches = [branch]
        elif not branches:
            if only_tags:
                branches = lambda ref: ref.startswith('refs/tags/')  # noqa: E731
            else:
                branches = ['master']

        self.repourl = repourl
        self.branches = branches
        self.encoding = encoding
        self.buildPushesWithNoCommits = buildPushesWithNoCommits
        self.gitbin = gitbin
        self.workdir = workdir