コード例 #1
0
    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)
コード例 #2
0
ファイル: builder.py プロジェクト: stuarta/buildbot
    def canStartBuild(self, workerforbuilder, buildrequest):
        can_start = True

        # check whether the locks that the build will acquire can actually be
        # acquired
        locks = self.config.locks
        if IRenderable.providedBy(locks):
            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(props, [buildrequest],
                                                        self, workerforbuilder)
            locks = yield props.render(locks)

        locks = [(self.botmaster.getLockFromLockAccess(access), access)
                 for access in locks]
        if locks:
            can_start = Build._canAcquireLocks(locks, workerforbuilder)
        if can_start is False:
            defer.returnValue(can_start)

        if callable(self.config.canStartBuild):
            can_start = yield self.config.canStartBuild(self, workerforbuilder,
                                                        buildrequest)
        defer.returnValue(can_start)
コード例 #3
0
ファイル: hyper.py プロジェクト: zahedbri/buildbot
    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))
コード例 #4
0
ファイル: chromeos_factory.py プロジェクト: eunchong/build
  def add_chromite_step(self, script, params, b_params, legacy=False):
    """Adds a step that runs a chromite command.

    Args:
      script:  Name of the script to run from chromite/bin.
      params: space-delimited string of parameters to pass to the cbuildbot
          command, or IRenderable.
      b_params:  An array of StepParameters.
      legacy:  Use a different directory for some legacy invocations.
    """
    script_subdir = 'buildbot' if legacy else 'bin'
    cmd = ['%s/%s/%s' % (self.chromite_dir, script_subdir, script)]
    if b_params:
      cmd.extend(b_params)
    if not params:
      pass
    elif isinstance(params, basestring):
      cmd.extend(params.split())
    elif IRenderable.providedBy(params):
      cmd += [params]
    else:
      raise TypeError("Unsupported 'params' type: %s" % (type(params),))

    self.f_cbuild.addStep(chromium_step.AnnotatedCommand,
                          command=cmd,
                          timeout=self.timeout,
                          name=script,
                          description=script,
                          usePTY=False,
                          **self.step_args)
コード例 #5
0
ファイル: builder.py プロジェクト: toddrobinsonce/buildbot
    def canStartWithWorkerForBuilder(self,
                                     workerforbuilder,
                                     buildrequests=None):
        locks = self.config.locks
        if IRenderable.providedBy(locks):
            if buildrequests is None:
                raise RuntimeError("buildrequests parameter must be specified "
                                   " when using renderable builder locks. Not "
                                   "specifying buildrequests is deprecated")

            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(
                props, buildrequests, self, workerforbuilder)
            locks = yield props.render(locks)

        # Make sure we don't warn and throw an exception at the same time
        if buildrequests is None:
            warnings.warn("Not passing corresponding buildrequests to "
                          "Builder.canStartWithWorkerForBuilder is deprecated")

        locks = [(self.botmaster.getLockFromLockAccess(access), access)
                 for access in locks]
        can_start = Build.canStartWithWorkerForBuilder(locks, workerforbuilder)
        defer.returnValue(can_start)
コード例 #6
0
ファイル: properties.py プロジェクト: rayalan/buildbot
    def __init__(self, function, *args, **kwargs):
        if not callable(function) and not IRenderable.providedBy(function):
            config.error("function given to Transform neither callable nor renderable")

        self._function = function
        self._args = args
        self._kwargs = kwargs
コード例 #7
0
    def canStartBuild(self, workerforbuilder, buildrequest):
        can_start = True

        # check whether the locks that the build will acquire can actually be
        # acquired
        locks = self.config.locks
        if IRenderable.providedBy(locks):
            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(
                props, [buildrequest], self, workerforbuilder)
            locks = yield props.render(locks)

        locks = [(self.botmaster.getLockFromLockAccess(access), access)
                 for access in locks]
        if locks:
            can_start = Build._canAcquireLocks(locks, workerforbuilder)
        if can_start is False:
            defer.returnValue(can_start)

        if callable(self.config.canStartBuild):
            can_start = yield self.config.canStartBuild(
                self, workerforbuilder, buildrequest)
        defer.returnValue(can_start)
コード例 #8
0
ファイル: builder.py プロジェクト: djmitche/buildbot
    def canStartWithWorkerForBuilder(self, workerforbuilder, buildrequests=None):
        locks = self.config.locks
        if IRenderable.providedBy(locks):
            if buildrequests is None:
                raise RuntimeError("buildrequests parameter must be specified "
                                   " when using renderable builder locks. Not "
                                   "specifying buildrequests is deprecated")

            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(props, buildrequests,
                                                        self, workerforbuilder)
            locks = yield props.render(locks)

        # Make sure we don't warn and throw an exception at the same time
        if buildrequests is None:
            warnings.warn(
                "Not passing corresponding buildrequests to "
                "Builder.canStartWithWorkerForBuilder is deprecated")

        locks = [(self.botmaster.getLockFromLockAccess(access), access)
                 for access in locks]
        can_start = Build.canStartWithWorkerForBuilder(locks, workerforbuilder)
        defer.returnValue(can_start)
コード例 #9
0
    def add_chromite_step(self, script, params, b_params, legacy=False):
        """Adds a step that runs a chromite command.

    Args:
      script:  Name of the script to run from chromite/bin.
      params: space-delimited string of parameters to pass to the cbuildbot
          command, or IRenderable.
      b_params:  An array of StepParameters.
      legacy:  Use a different directory for some legacy invocations.
    """
        script_subdir = 'buildbot' if legacy else 'bin'
        cmd = ['%s/%s/%s' % (self.chromite_dir, script_subdir, script)]
        if b_params:
            cmd.extend(b_params)
        if not params:
            pass
        elif isinstance(params, basestring):
            cmd.extend(params.split())
        elif IRenderable.providedBy(params):
            cmd += [params]
        else:
            raise TypeError("Unsupported 'params' type: %s" % (type(params), ))

        self.f_cbuild.addStep(chromium_step.AnnotatedCommand,
                              command=cmd,
                              timeout=self.timeout,
                              name=script,
                              description=script,
                              usePTY=False,
                              **self.step_args)
コード例 #10
0
ファイル: properties.py プロジェクト: CapdinGames/katana
    def __init__(self, function, *args, **kwargs):
        if not callable(function) and not IRenderable.providedBy(function):
            config.error("function given to Transform neither callable nor renderable")

        self._function = function
        self._args = args
        self._kwargs = kwargs
コード例 #11
0
    def getRenderingFor(self, build):
        # Test whether we're going to render
        is_present = self.condition(build)

        # Choose our inner IRenderer and render it
        renderer = (self.present) if is_present else (self.absent)
        # Disable 'too many positional arguments' error | pylint: disable=E1121
        return IRenderable(renderer).getRenderingFor(build)
コード例 #12
0
    def setProperty(self, name, value, source, runtime=False):
        name = util.bytes2unicode(name)
        if not IRenderable.providedBy(value):
            json.dumps(value)  # Let the exception propagate ...
        source = util.bytes2unicode(source)

        self.properties[name] = (value, source)
        if runtime:
            self.runtime.add(name)
コード例 #13
0
ファイル: steps.py プロジェクト: pitrou/ursabot
    def __init__(self, args=tuple(), command=tuple(), **kwargs):
        command, args = command or self.command, args or self.args

        if not IRenderable.providedBy(command) and not command:
            raise ValueError('No command was provided')

        kwargs['command'] = util.FlattenList([command, args])
        kwargs = self.setupShellMixin(kwargs)
        super().__init__(**kwargs)
コード例 #14
0
ファイル: reporters.py プロジェクト: sbinet-gonum/ursabot
 def checkConfig(self, stream, topic, formatter, **kwargs):
     super().checkConfig(**kwargs)
     if not isinstance(stream, str):
         config.error('`stream` must be an instance of str')
     if not (isinstance(topic, str) or IRenderable.providedBy(topic)):
         config.error('`topic` must be a renderable or an instance of str')
     if not isinstance(formatter, (type(None), Formatter)):
         config.error('`formatter` must be an instance of '
                      'ursabot.formatters.Formatter')
     super().checkConfig(**kwargs)
コード例 #15
0
ファイル: cmake.py プロジェクト: Cray/buildbot
    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)
コード例 #16
0
    def __init__(self, **kwargs):
        self.worker = None

        for p in self.__class__.parms:
            if p in kwargs:
                setattr(self, p, kwargs.pop(p))

        if kwargs:
            config.error(
                f"{self.__class__}.__init__ got unexpected keyword argument(s) "
                f"{list(kwargs)}")
        self._pendingLogObservers = []

        if not isinstance(self.name, str) and not IRenderable.providedBy(
                self.name):
            config.error(
                f"BuildStep name must be a string or a renderable object: "
                f"{repr(self.name)}")

        check_param_length(self.name, f'Step {self.__class__.__name__} name',
                           Model.steps.c.name.type.length)

        if isinstance(self.description, str):
            self.description = [self.description]
        if isinstance(self.descriptionDone, str):
            self.descriptionDone = [self.descriptionDone]
        if isinstance(self.descriptionSuffix, str):
            self.descriptionSuffix = [self.descriptionSuffix]

        if self.updateBuildSummaryPolicy is None:
            # compute default value for updateBuildSummaryPolicy
            self.updateBuildSummaryPolicy = [EXCEPTION, RETRY, CANCELLED]
            if self.flunkOnFailure or self.haltOnFailure or self.warnOnFailure:
                self.updateBuildSummaryPolicy.append(FAILURE)
            if self.warnOnWarnings or self.flunkOnWarnings:
                self.updateBuildSummaryPolicy.append(WARNINGS)
        if self.updateBuildSummaryPolicy is False:
            self.updateBuildSummaryPolicy = []
        if self.updateBuildSummaryPolicy is True:
            self.updateBuildSummaryPolicy = ALL_RESULTS
        if not isinstance(self.updateBuildSummaryPolicy, list):
            config.error("BuildStep updateBuildSummaryPolicy must be "
                         "a list of result ids or boolean but it is "
                         f"{repr(self.updateBuildSummaryPolicy)}")
        self._acquiringLocks = []
        self.stopped = False
        self.master = None
        self.statistics = {}
        self.logs = {}
        self._running = False
        self.stepid = None
        self.results = None
        self._start_unhandled_deferreds = None
        self._test_result_submitters = {}
コード例 #17
0
ファイル: hyper.py プロジェクト: Cray/buildbot
    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-py>=1.4' 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))
コード例 #18
0
    def __init__(self, **kwargs):
        self.worker = None
        self._registerOldWorkerAttr("worker", name="buildslave")

        for p in self.__class__.parms:
            if p in kwargs:
                setattr(self, p, kwargs.pop(p))

        if kwargs:
            config.error("%s.__init__ got unexpected keyword argument(s) %s" %
                         (self.__class__, list(kwargs)))
        self._pendingLogObservers = []

        if not isinstance(self.name, str) and not IRenderable.providedBy(
                self.name):
            config.error(
                "BuildStep name must be a string or a renderable object: "
                "%r" % (self.name, ))

        if isinstance(self.description, str):
            self.description = [self.description]
        if isinstance(self.descriptionDone, str):
            self.descriptionDone = [self.descriptionDone]
        if isinstance(self.descriptionSuffix, str):
            self.descriptionSuffix = [self.descriptionSuffix]

        if self.updateBuildSummaryPolicy is None:  # compute default value for updateBuildSummaryPolicy
            self.updateBuildSummaryPolicy = [EXCEPTION, RETRY, CANCELLED]
            if self.flunkOnFailure or self.haltOnFailure or self.warnOnFailure:
                self.updateBuildSummaryPolicy.append(FAILURE)
            if self.warnOnWarnings or self.flunkOnWarnings:
                self.updateBuildSummaryPolicy.append(WARNINGS)
        if self.updateBuildSummaryPolicy is False:
            self.updateBuildSummaryPolicy = []
        if self.updateBuildSummaryPolicy is True:
            self.updateBuildSummaryPolicy = ALL_RESULTS
        if not isinstance(self.updateBuildSummaryPolicy, list):
            config.error("BuildStep updateBuildSummaryPolicy must be "
                         "a list of result ids or boolean but it is %r" %
                         (self.updateBuildSummaryPolicy, ))
        self._acquiringLock = None
        self.stopped = False
        self.master = None
        self.statistics = {}
        self.logs = {}
        self._running = False
        self.stepid = None
        self.results = None
        self._start_unhandled_deferreds = None
コード例 #19
0
ファイル: buildstep.py プロジェクト: cmouse/buildbot
    def __init__(self, **kwargs):
        self.worker = None
        self._registerOldWorkerAttr("worker", name="buildslave")

        for p in self.__class__.parms:
            if p in kwargs:
                setattr(self, p, kwargs.pop(p))

        if kwargs:
            config.error("%s.__init__ got unexpected keyword argument(s) %s"
                         % (self.__class__, list(kwargs)))
        self._pendingLogObservers = []

        if not isinstance(self.name, str) and not IRenderable.providedBy(self.name):
            config.error("BuildStep name must be a string or a renderable object: "
                         "%r" % (self.name,))

        if isinstance(self.description, str):
            self.description = [self.description]
        if isinstance(self.descriptionDone, str):
            self.descriptionDone = [self.descriptionDone]
        if isinstance(self.descriptionSuffix, str):
            self.descriptionSuffix = [self.descriptionSuffix]

        if self.updateBuildSummaryPolicy is None:  # compute default value for updateBuildSummaryPolicy
            self.updateBuildSummaryPolicy = [EXCEPTION, RETRY, CANCELLED]
            if self.flunkOnFailure or self.haltOnFailure or self.warnOnFailure:
                self.updateBuildSummaryPolicy.append(FAILURE)
            if self.warnOnWarnings or self.flunkOnWarnings:
                self.updateBuildSummaryPolicy.append(WARNINGS)
        if self.updateBuildSummaryPolicy is False:
            self.updateBuildSummaryPolicy = []
        if self.updateBuildSummaryPolicy is True:
            self.updateBuildSummaryPolicy = ALL_RESULTS
        if not isinstance(self.updateBuildSummaryPolicy, list):
            config.error("BuildStep updateBuildSummaryPolicy must be "
                         "a list of result ids or boolean but it is %r" %
                         (self.updateBuildSummaryPolicy,))
        self._acquiringLock = None
        self.stopped = False
        self.master = None
        self.statistics = {}
        self.logs = {}
        self._running = False
        self.stepid = None
        self.results = None
        self._start_unhandled_deferreds = None
コード例 #20
0
    def canStartBuild(self, workerforbuilder, buildrequest):
        can_start = True

        # check whether the locks that the build will acquire can actually be
        # acquired
        locks = self.config.locks
        worker = workerforbuilder.worker
        props = None

        # don't unnecessarily setup properties for build
        def setupPropsIfNeeded(props):
            if props is not None:
                return props
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(
                props, [buildrequest], self, workerforbuilder)
            return props

        if worker.builds_may_be_incompatible:
            # Check if the latent worker is actually compatible with the build.
            # The instance type of the worker may depend on the properties of
            # the build that substantiated it.
            props = setupPropsIfNeeded(props)
            can_start = yield worker.isCompatibleWithBuild(props)
            if not can_start:
                return False

        if IRenderable.providedBy(locks):
            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = setupPropsIfNeeded(props)
            locks = yield props.render(locks)

        locks = yield self.botmaster.getLockFromLockAccesses(
            locks, self.config_version)

        if locks:
            can_start = Build._canAcquireLocks(locks, workerforbuilder)
            if can_start is False:
                return can_start

        if callable(self.config.canStartBuild):
            can_start = yield self.config.canStartBuild(
                self, workerforbuilder, buildrequest)
        return can_start
コード例 #21
0
ファイル: builder.py プロジェクト: buildbot/buildbot
    def canStartBuild(self, workerforbuilder, buildrequest):
        can_start = True

        # check whether the locks that the build will acquire can actually be
        # acquired
        locks = self.config.locks
        worker = workerforbuilder.worker
        props = None

        # don't unnecessarily setup properties for build
        def setupPropsIfNeeded(props):
            if props is not None:
                return
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(props, [buildrequest],
                                                        self, workerforbuilder)
            return props

        if worker.builds_may_be_incompatible:
            # Check if the latent worker is actually compatible with the build.
            # The instance type of the worker may depend on the properties of
            # the build that substantiated it.
            props = setupPropsIfNeeded(props)
            can_start = yield worker.isCompatibleWithBuild(props)
            if not can_start:
                return False

        if IRenderable.providedBy(locks):
            # collect properties that would be set for a build if we
            # started it now and render locks using it
            props = setupPropsIfNeeded(props)
            locks = yield props.render(locks)

        locks = [(self.botmaster.getLockFromLockAccess(access), access)
                 for access in locks]
        if locks:
            can_start = Build._canAcquireLocks(locks, workerforbuilder)
            if can_start is False:
                return can_start

        if callable(self.config.canStartBuild):
            can_start = yield self.config.canStartBuild(self, workerforbuilder,
                                                        buildrequest)
        return can_start
コード例 #22
0
ファイル: config.py プロジェクト: p5-vbnekit/forks.buildbot
    def check_locks(self):
        # assert that all locks used by the Builds and their Steps are
        # uniquely named.
        lock_dict = {}

        def check_lock(lock):
            if isinstance(lock, locks.LockAccess):
                lock = lock.lockid
            if lock.name in lock_dict:
                if lock_dict[lock.name] is not lock:
                    msg = "Two locks share the same name, '%s'" % lock.name
                    error(msg)
            else:
                lock_dict[lock.name] = lock

        for b in self.builders:
            if b.locks and not IRenderable.providedBy(b.locks):
                for lock in b.locks:
                    check_lock(lock)
コード例 #23
0
ファイル: config.py プロジェクト: ewongbb/buildbot
    def check_locks(self):
        # assert that all locks used by the Builds and their Steps are
        # uniquely named.
        lock_dict = {}

        def check_lock(lock):
            if isinstance(lock, locks.LockAccess):
                lock = lock.lockid
            if lock.name in lock_dict:
                if lock_dict[lock.name] is not lock:
                    msg = "Two locks share the same name, '%s'" % lock.name
                    error(msg)
            else:
                lock_dict[lock.name] = lock

        for b in self.builders:
            if b.locks and not IRenderable.providedBy(b.locks):
                for lock in b.locks:
                    check_lock(lock)
コード例 #24
0
ファイル: steps.py プロジェクト: kou/ursabot
    def __init__(self,
                 args=tuple(),
                 command=tuple(),
                 as_shell=False,
                 quote=True,
                 **kwargs):
        command, args = command or self.command, args or self.args

        if not IRenderable.providedBy(command) and not command:
            raise ValueError('No command was provided')

        cmd = util.FlattenList([command, args])
        if as_shell:
            # runs the command as is without quoting any arguments of it
            cmd = util.Transform(' '.join, cmd)

        kwargs['command'] = cmd
        kwargs = self.setupShellMixin(kwargs)
        super().__init__(**kwargs)
コード例 #25
0
 def render(self, value):
     renderable = IRenderable(value)
     return defer.maybeDeferred(renderable.getRenderingFor, self)
コード例 #26
0
ファイル: properties.py プロジェクト: M0E-lnx/buildbot
 def render(self, value):
     renderable = IRenderable(value)
     return renderable.getRenderingFor(self)
コード例 #27
0
 def render(self, value):
     """
     Return a variant of value that has any WithProperties objects
     substituted.  This recurses into Python's compound data types.
     """
     return IRenderable(value).render(self)
 def render(self, value):
     self.props.build = self
     return defer.maybeDeferred(
         IRenderable(value).getRenderingFor, self.props)
コード例 #29
0
 def render(self, value):
     return IRenderable(value).getRenderingFor(self)
コード例 #30
0
 def render(self, value):
     self.props.build = self
     return IRenderable(value).getRenderingFor(self.props)
コード例 #31
0
ファイル: trigger.py プロジェクト: mokibit/buildbot
 def hasRenderable(l):
     for s in l:
         if IRenderable.providedBy(s):
             return True
     return False
コード例 #32
0
ファイル: properties.py プロジェクト: ctemplin/buildbot
 def render(self, value):
     renderable = IRenderable(value)
     return renderable.getRenderingFor(self)