How to use the buildbot.process.properties.Properties 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 / www / hooks / github.py View on Github external
signature = bytes2unicode(signature)

        if not signature and self._strict:
            raise ValueError('Request has no required signature')

        if self._secret and signature:
            try:
                hash_type, hexdigest = signature.split('=')
            except ValueError:
                raise ValueError(
                    'Wrong signature format: {}'.format(signature))

            if hash_type != 'sha1':
                raise ValueError('Unknown hash type: {}'.format(hash_type))

            p = Properties()
            p.master = self.master
            rendered_secret = yield p.render(self._secret)

            mac = hmac.new(unicode2bytes(rendered_secret),
                           msg=unicode2bytes(content),
                           digestmod=sha1)

            def _cmp(a, b):
                try:
                    # try the more secure compare_digest() first
                    from hmac import compare_digest
                    return compare_digest(a, b)
                except ImportError:  # pragma: no cover
                    # and fallback to the insecure simple comparison otherwise
                    return a == b
github mozilla / build-tools / mozilla / tools / buildbotcustom / buildbotcustom / l10n.py View on Github external
def queueBuild(self, app, locale, builders, change, tree = None):
    """
    Callback function for dispatchers to tell us what to build.
    This function actually submits the buildsets on non-mergable
    sourcestamps.
    """
    changes = [change]
    log.debug("scheduler", "queueBuild: build %s for change %d" % 
              (', '.join(builders), change.number))
    props = properties.Properties()
    props.updateFromProperties(self.properties)
    props.update(dict(app=app, locale=locale, tree=tree,
                      needsCheckout = True), 'Scheduler')
    bs = buildset.BuildSet(builders,
                           Scheduler.NoMergeStamp(changes=changes),
                           reason = "%s %s" % (tree, locale),
                           properties = props)
    self.submitBuildSet(bs)
github buildbot / buildbot / master / buildbot / process / builder.py View on Github external
def setupPropsIfNeeded(props):
            if props is not None:
                return
            props = Properties()
            Build.setupPropertiesKnownBeforeBuildStarts(props, [buildrequest],
                                                        self, workerforbuilder)
            return props
github Piasy / webrtc / tools / continuous_build / build_internal / scripts / webrtc_buildbot / utils.py View on Github external
build_status_oracle: An instance of BuildStatusOracle which is used to
        keep track of our build state.
      is_try_slave: If this bot is a try slave. Needed since we're handling
        some things differently between normal slaves and try slaves.
      gclient_solution_name: The name of the solution used for gclient.
      svn_url: The Subversion URL for gclient to sync agains.
      custom_deps_list: Content to be put in the custom_deps entry of the
        .gclient file. The parameter must be a list of tuples with two
        strings in each: path and remote URL.
      safesync_url: If a LKGR URL shall be used for the gclient sync command.
    """
    factory.BuildFactory.__init__(self)

    self.build_status_oracle = build_status_oracle
    self.is_try_slave = is_try_slave
    self.properties = properties.Properties()
    self.gyp_params = ['-Dfastbuild=1']  # No debug symbols = build speedup
    self.release = False
    self.path_joiner = PosixPathJoin
    # For GClient solution definition:
    self.gclient_solution_name = gclient_solution_name
    self.svn_url = svn_url
    self.custom_deps_list = custom_deps_list
    self.safesync_url = safesync_url
github google / skia-buildbot / experimental / skia_master_scripts / schedulers.py View on Github external
def _got_pending(pending):
      dl = []
      for bs in pending:
        props = properties.Properties()
        props.updateFromProperties(build_props)
        props.update({'ssid': ssid}, 'Scheduler')
        props.update(bs['properties'] or {}, 'Scheduler')
        dl.append(
            base.BaseScheduler.addBuildsetForSourceStamp(self,
                ssid=ssid,
                reason=bs['reason'],
                external_idstring=bs['external_idstring'],
                properties=props))
      if not dl:
        return defer.succeed(None)
      d = defer.DeferredList(dl)
      d.addCallback(_added_buildsets)
      return d
    d = self.master.skia_db.pending_buildsets.get_pending_buildsets(ssid,
github buildbot / buildbot / master / buildbot / process / builder.py View on Github external
def rebuildBuild(self, bs, reason="", extraProperties=None):
        if not bs.isFinished():
            return

        # Make a copy of the properties so as not to modify the original build.
        properties = Properties()
        # Don't include runtime-set properties in a rebuild request
        properties.updateFromPropertiesNoRuntime(bs.getProperties())
        if extraProperties is None:
            properties.updateFromProperties(extraProperties)

        properties_dict = dict((k,(v,s)) for (k,v,s) in properties.asList())
        ss = bs.getSourceStamp(absolute=True)
        d = ss.getSourceStampId(self.master.master)
        def add_buildset(ssid):
            return self.master.master.addBuildset(
                    builderNames=[self.original.name],
                    ssid=ssid, reason=reason, properties=properties_dict)
        d.addCallback(add_buildset)
        return d
github buildbot / buildbot / master / buildbot / schedulers / trysched.py View on Github external
reason = "'try' job"

        if who:
            reason += " by user {}".format(bytes2unicode(who))

        if comment:
            reason += " ({})".format(bytes2unicode(comment))

        sourcestamp = dict(
            branch=branch, revision=revision, repository=repository,
            project=project, patch_level=patch[0], patch_body=patch[1],
            patch_subdir='', patch_author=who or '',
            patch_comment=comment or '', codebase='',
        )           # note: no way to specify patch subdir - #1769

        requested_props = Properties()
        requested_props.update(properties, "try build")
        (bsid, brids) = yield self.scheduler.addBuildsetForSourceStamps(
            sourcestamps=[sourcestamp], reason=reason,
            properties=requested_props, builderNames=builderNames)

        # return a remotely-usable BuildSetStatus object
        bss = RemoteBuildSetStatus(self.scheduler.master, bsid, brids)
        return bss
github buildbot / buildbot / master / buildbot / util / service.py View on Github external
def reconfigServiceWithSibling(self, sibling):
        # only reconfigure if sibling is configured differently.
        # sibling == self is using ComparableMixin's implementation
        # only compare compare_attrs
        if self.configured and sibling == self:
            return None
        self.configured = True
        # render renderables in parallel
        # Properties import to resolve cyclic import issue
        from buildbot.process.properties import Properties
        p = Properties()
        p.master = self.master
        # render renderables in parallel
        secrets = []
        kwargs = {}
        accumulateClassList(self.__class__, 'secrets', secrets)
        for k, v in sibling._config_kwargs.items():
            if k in secrets:
                # for non reconfigurable services, we force the attribute
                v = yield p.render(v)
                setattr(sibling, k, v)
                setattr(self, k, v)
            kwargs[k] = v

        d = yield self.reconfigService(*sibling._config_args,
                                       **kwargs)
        return d
github ursa-labs / ursabot / ursabot / builders.py View on Github external
Specifies the name of a subdirectory of the master’s basedir in
           which everything related to this builder will be stored. This
           holds build status information. If not set, this parameter
           defaults to the builder name, with some characters escaped. Each
           builder must have a unique build directory.
        self.workerbuilddir:
           Specifies the name of a subdirectory (under the worker’s
           configured base directory) in which everything related to this
           builder will be placed on the worker. This is where checkouts,
           compiles, and tests are run. If not set, defaults to builddir.
           If a worker is connected to multiple builders that share the same
           workerbuilddir, make sure the worker is set to run one build at a
           time or ensure this is fine to run multiple builds from the same
           directory simultaneously.
        """
        props = Properties(
            buildername=str(self.name),
            builddir=str(self.builddir),
            workerbuilddir=str(self.workerbuilddir),
            docker_image=str(self.image),
            docker_workdir=self.image.workdir,
        )
        rendered = props.render({
            **self.properties,
            'docker_image': str(self.image),
            'docker_workdir': self.image.workdir,
            'docker_volumes': self.volumes,
            'docker_hostconfig': self.hostconfig
        })
        return rendered.result