Ejemplo n.º 1
0
def create_slave(name, **kwargs):
    import pcfg
    passwd = pcfg.get_password(name)

    slave = BuildSlave(name, passwd, **kwargs)
    slave.pys = {}
    slave.pgs = {}
    slave.tested_pairs = []
    return slave
Ejemplo n.º 2
0
def sample_slave(c, common_branch):

    #create a new slave in the master's database
    c['slaves'].append(BuildSlave("sample_slave_name", "password"))

    # lauch the builders listed in "builderNames" whenever the change poller notices a change to github pocl
    c['schedulers'].append(
        SingleBranchScheduler(
            name="name for scheduler, not sure where this is used",
            change_filter=filter.ChangeFilter(branch=common_branch),
            treeStableTimer=60,
            builderNames=[
                "sample_builder_name - this is the name that appears on the webpage"
            ]))

    #create one set of steps to build pocl. See poclfactory.py for details
    # on how to configure it
    sample_factory = createPoclFactory()

    #register your build to the master
    c['builders'].append(
        BuilderConfig(
            name=
            "sample_builder_name - this is the name that appears on the webpage",
            slavenames=["sample_slave_name"],
            factory=sample_factory))
Ejemplo n.º 3
0
def masterConfig():
    c = {}
    from buildbot.buildslave import BuildSlave
    from buildbot.config import BuilderConfig
    from buildbot.process.buildstep import BuildStep
    from buildbot.process.factory import BuildFactory
    from buildbot.status import results

    class MyBuildStep(BuildStep):
        def start(self):
            self.finished(results.SUCCESS)

    c['slaves'] = [BuildSlave("local1", "localpw")]
    c['slavePortnum'] = 0
    c['change_source'] = []
    c['schedulers'] = []  # filled in above
    f1 = BuildFactory()
    f1.addStep(MyBuildStep(name='one'))
    f1.addStep(MyBuildStep(name='two'))
    c['builders'] = [
        BuilderConfig(name="a", slavenames=["local1"], factory=f1),
    ]
    c['status'] = []
    c['title'] = "test"
    c['titleURL'] = "test"
    c['buildbotURL'] = "http://localhost:8010/"
    c['db'] = {'db_url': "sqlite:///state.sqlite"}
    c['mq'] = {'debug': True}
    # test wants to influence the config, but we still return a new config each time
    c.update(BuildmasterConfig)
    return c
Ejemplo n.º 4
0
def sample_slave(c):

    #create a new slave in the master's database
    c['slaves'].append(BuildSlave("sample_slave_name", "password"))

    # build the tree whenever the change poller notices a change
    c['schedulers'].append(
        SingleBranchScheduler(
            name="master",
            change_filter=filter.ChangeFilter(branch='master'),
            treeStableTimer=60,
            fileIsImportant=shouldBuildTrigger,
            builderNames=["sample_builder_name"]))
    # Allow authenticated (to the buildmaster) users to force a build
    # Optionally, force a full build, i.e. 'git clean -f -d -x' instead
    # of a incremental build (essentially 'git pull && make)
    c['schedulers'].append(
        ForceScheduler(name="a name for your forcescheduler",
                       branch=FixedParameter(name="branch", default=""),
                       revision=FixedParameter(name="revision", default=""),
                       repository=FixedParameter(name="repository",
                                                 default=""),
                       project=FixedParameter(name="repository", default=""),
                       builderNames=["sample_LLVM_builder_name"],
                       properties=[
                           ChoiceStringParameter(
                               name="git_mode",
                               label="how to update git (see buildbot docs)",
                               choices=["incremental", "full"],
                               default="incremental")
                       ]))

    #create one set of steps to build pocl. See poclfactory.py for
    #parameters to pass this function.
    #You can create as many factories+builders as your slave has space & need for
    #e.g. one per LLVM version, or different build options for pocl
    sample_factory = createPoclFactory()

    #register your build to the master
    c['builders'].append(
        BuilderConfig(name="sample_builder_name",
                      slavenames=["sample_slave_name"],
                      factory=sample_factory))

    #create one set of steps to build latest LLVM. This is a check for if LLVM
    # has introduced regressions (e.g. API changes, asserts or codegen issues)
    # This factory:
    # - builds LLVM from svn & runs its checks
    # - installs LLVM to a temporary directory
    # - builds & checks pocl against this LLVM
    # - installs the built LLVM into a permanent directory
    # You want also a pocl factory/builder to run against this second installation LLVM
    # to check if pocl has introduced regressions.
    #. See poclfactory.py for parameters to pass this function
    sample_LLVM_factory = createLLVMFactory()

    c['builders'].append(
        BuilderConfig(name="sample_LLVM_builder_name",
                      slavenames=["sample_slave_name"],
                      factory=sample_LLVM_factory))
Ejemplo n.º 5
0
def setup(c, config):
    c["slaves"] = []

    for name, info in config["slaves"].items():
        c["slaves"].append(BuildSlave(name, info["password"],
                                      max_builds=1))

    c["slavePortnum"] = config["slaves_port"]
Ejemplo n.º 6
0
def update_params_dict(c):
    c['slaves'].append(BuildSlave("Win_Server_Business", "123456"))
    #c['change_source'].append(cs_gitpoller)	
    c['schedulers'].append(scheduler_win_Server_Business_build)
    c['schedulers'].append(Win_Server_Business_time)
    c['schedulers'].append(win_Server_Business_force_builder)
    c['builders'].append(b_win_Server_Business)
    c['status'].append(win_Server_Business_mail)
    return c
Ejemplo n.º 7
0
    def all(cls, section_items):
        """Takes a list of options (read: configparser.items()) and splits those
			 into the corresponding slaves (each line in this section is a separate 
			 	slave)
		"""

        for name, value in section_items:
            slave = BuildSlave(name, value, max_builds=1)
            yield slave
Ejemplo n.º 8
0
def read_slaves(fn):
    """ Reads buildslave information from a JSON file. """
    slaves = []

    data = json.load(open(fn, 'r'))
    for slave_data in data:
        slaves.append(BuildSlave(**slave_data))

    return slaves
Ejemplo n.º 9
0
def worker(name, password):
    """Adds a new worker node.

    All worker nodes are configured to run at most one build at a time.

    Arguments:
    - name: The name of the worker node, shown in the web interface.
    - password: Password used by the agent installed on worker nodes to authenticate with the
      master.

    """
    # In general, our slaves assume that they have full control of the machine they are running on,
    # thus, we force at most one job running on each node at a time.
    BuildmasterConfig['slaves'].append(BuildSlave(name, password,
                                                  max_builds=1))
    def make_slaves(self, conf_path='slaves.cfg'):
        """Create the slave objects from the file at conf_path.

        ``conf_path`` is interpreted relative from buildmaster_dir. It can of
        course be an absolute path.

        The configuration file is in INI format. There's one section per slave,
        The section name is the slave name.
        The password must be specified as 'password'
        Other values either go to slave properties, unless they are from the
        BUILDSLAVE_KWARGS constant, in which case they are used directly in
        instantiation keyword arguments.

        For properties, the BUILDSLAVE_PROPERTIES dict of validators is
        also used (with default to ``str``)

        There is for now no limitation on which properties can be set.
        """
        parser = ConfigParser()
        parser.read(self.path_from_buildmaster(conf_path))
        slaves = []

        for slavename in parser.sections():
            kw = {}
            kw['properties'] = props = {}
            props['capability'] = caps = {}  # name -> versions
            seen = set()
            for key, value in parser.items(slavename):
                seen.add(key)
                if key in ('passwd', 'password'):
                    pwd = value
                elif key == 'capability':
                    caps.update(capability.parse_slave_declaration(value))
                elif key in BUILDSLAVE_KWARGS:
                    kw[key] = BUILDSLAVE_KWARGS[key](value)
                else:
                    props[key] = BUILDSLAVE_PROPERTIES.get(key, str)(value)

            for option in BUILDSLAVE_REQUIRED:
                if option not in seen:
                    logger.error("Buildslave %r lacks option %r. Ignored.",
                                 slavename, option)
                    break
            else:
                slave = BuildSlave(slavename, pwd, **kw)
                slaves.append(slave)

        return slaves
Ejemplo n.º 11
0
 def testShellCommand1(self):
     cmd = "argle bargle"
     dir = "murkle"
     self.expectedEvents = []
     buildstep.RemoteCommand.commandCounter[0] = 3
     c = MyShellCommand(workdir=dir, command=cmd, timeout=10)
     c.setBuild(self.build)
     c.setBuildSlave(BuildSlave("name", "password"))
     self.assertEqual(self.remote.events, self.expectedEvents)
     c.step_status = self.build_status.addStepWithName("myshellcommand")
     d = c.startStep(self.remote)
     self.failUnless(c.started)
     d.addCallbacks(self.callback, self.errback)
     d2 = self.poll()
     d2.addCallback(self._testShellCommand1_2, c)
     return d2
    def _getBuildSlaves(self):
        """
        Create slaves.
        """
        slaves = self._raw['slaves']
        result = []
        defaults = slaves[DEFAULT]
        default_password = defaults['password']

        for name, configuration in slaves.items():
            if name == DEFAULT:
                continue

            # Start with default configuration and then overwrite based on
            # slave custom configuration.
            kwargs = defaults.copy()
            kwargs.update(configuration)

            result.append(BuildSlave(name, **kwargs))

        return result
Ejemplo n.º 13
0
 def __init__(self, name, is_leap):
     self.name = name
     self.is_leap = is_leap
     BuildSlave.__init__(self, name, self.PASSWORDS[name])
Ejemplo n.º 14
0
from buildbot.buildslave import BuildSlave
from buildbot.config import BuilderConfig
from buildbot.process.factory import BuildFactory
from buildbot.steps.shell import ShellCommand

from buildbot_config.settings.settings import BRANCH, PROJECT_NAME, PROJECT_CODE_URL

nickname = 'pg'
name = 'slave-%s' % nickname
builder_name = 'builder-%s' % nickname
# slave
slave = BuildSlave(name, "%spassword" % name)
# builder
factory = BuildFactory()
factory.addStep(
    ShellCommand(command="git pull origin develop", workdir=PROJECT_CODE_URL))
# Pip install and update to environment which run this buildbot
factory.addStep(
    ShellCommand(command=[
        "pip", "install", "--upgrade", "--requirement=setup/requirements.txt"
    ],
                 workdir=PROJECT_CODE_URL))
factory.addStep(
    ShellCommand(command=["pip", "freeze"], workdir=PROJECT_CODE_URL))
factory.addStep(
    ShellCommand(command=["/bin/bash", "reset_db"], workdir=PROJECT_CODE_URL))
factory.addStep(
    ShellCommand(command=[
        "/bin/bash", "runtests",
        "--settings=%s_project.settings.pg_buildbot" % PROJECT_NAME,
        "--noinput"
Ejemplo n.º 15
0
        except KeyError, e:
            log.msg("config dictionary is missing a required parameter")
            log.msg("leaving old configuration in place")
            raise

        #if "bots" in config:
        #    raise KeyError("c['bots'] is no longer accepted")

        slaves = config.get('slaves', [])
        if "bots" in config:
            m = ("c['bots'] is deprecated as of 0.7.6 and will be "
                 "removed by 0.8.0 . Please use c['slaves'] instead.")
            log.msg(m)
            warnings.warn(m, DeprecationWarning)
            for name, passwd in config['bots']:
                slaves.append(BuildSlave(name, passwd))

        if "bots" not in config and "slaves" not in config:
            log.msg("config dictionary must have either 'bots' or 'slaves'")
            log.msg("leaving old configuration in place")
            raise KeyError("must have either 'bots' or 'slaves'")

        #if "sources" in config:
        #    raise KeyError("c['sources'] is no longer accepted")

        change_source = config.get('change_source', [])
        if isinstance(change_source, (list, tuple)):
            change_sources = change_source
        else:
            change_sources = [change_source]
        if "sources" in config:
Ejemplo n.º 16
0
c['title'] = config.APP_NAME
c['titleURL'] = ""

c['buildbotURL'] = "{}:{}/".format(config.BUILDBOT_HOST, config.BUILDBOT_PORT)

####### DB URL

c['db'] = {
    'db_url': "sqlite:///state.sqlite",
}

####### BUILDSLAVES

from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave(config.SLAVE_NAME, config.SLAVE_PSW)]

c['protocols'] = {'pb': {'port': 9989}}

####### CHANGESOURCES

from buildbot.changes.gitpoller import GitPoller
c['change_source'] = []
c['change_source'].append(
    GitPoller(config.REPOSITORY,
              workdir='gitpoller-workdir',
              branches=True,
              pollinterval=5))

####### SCHEDULERS
Ejemplo n.º 17
0
from buildbot.buildslave import BuildSlave

slaves = [
    BuildSlave("slave", "pass"),
]
 def __init__(self, *args, **kwargs):
     """Enforces max_builds == 1 for obvious reasons."""
     kwargs['max_builds'] = 1
     BuildSlave.__init__(self, *args, **kwargs)
Ejemplo n.º 19
0
 def makeStep(self, factory, **kwargs):
     step = makeBuildStep(self.masterbase, factory, **kwargs)
     step.setBuildSlave(BuildSlave("name", "password"))
     step.setDefaultWorkdir(self.workdir)
     return step
Ejemplo n.º 20
0
]

# List of slave names for each platform.
linux_slaves = ["build-lnx"]
windows_slaves = ["build-win"]
macosx_slaves = ["build-osx"]

# These files contain metadata (incl. passwords) of the slaves and users.
slaves_fn = "slaves.json"
users_fn = "users.json"

# Load the slaves from an external JSON file, since we don't want
# the slave passwords to become publicly visible.
slaves = []
for slave_spec in json.load(open(slaves_fn, 'r')):
    slaves.append(BuildSlave(**slave_spec))

# Do the same for the user accounts of the web interface.
users = []
for user_spec in json.load(open(users_fn, 'r')):
    users.append((str(user_spec[0]), str(user_spec[1])))

from fnmatch import fnmatchcase


def _matches(file, pattern):
    file = file.lstrip('/')
    if pattern.startswith('/'):
        return fnmatchcase(file, pattern[1:])

    # Relative pattern.  Recurse through the hierarchy to see if it matches.
Ejemplo n.º 21
0
 def __init__(self, *args, **kwargs):
   """Enforces max_builds == 1 for obvious reasons."""
   kwargs['max_builds'] = 1
   BuildSlave.__init__(self, *args, **kwargs)
Ejemplo n.º 22
0
 def __init__(self, name, password, **kwargs):
     kwargs = self.extract_attrs(name, **kwargs)
     kwargs.setdefault('properties', {}).update(self.get_properties())
     BuildSlave.__init__(self, name, password, **kwargs)
Ejemplo n.º 23
0
 def createBuildSlave((name, password)):
     return BuildSlave(name, password, max_builds=1)
Ejemplo n.º 24
0
    def __init__(self,
                 name,
                 homepage,
                 secretsfile="~/myconfig.json",
                 *args,
                 **kwargs):
        dict.__init__(self, *args, **kwargs)

        # Find the directory containing this .py file
        thisfile = __file__
        thisfile = thisfile.replace(".pyc", ".py")
        try:
            thisfile = os.readlink(thisfile)
        except:
            pass
        dir = os.path.join(os.path.dirname(thisfile))

        masterjson = json.load(open(os.path.join(dir, "master.json")))

        # Lots of unrelated stuff is grouped here simply because buildbot needs it all.
        # See e.g. https://github.com/buildbot/buildbot/blob/master/master/buildbot/scripts/sample.cfg
        # for a simple hard-coded linear example of what buildbot needs set.
        # FIXME: find a more readable way to organize this

        # Since we need to process tags, disable merging for the moment
        # Later we can make this smarter and disable merging just changes
        # which are at tags, or enable merging just on builders that are
        # way too slow and don't mind missing a tag
        self['mergeRequests'] = False

        # PORT NUMBERS
        # It's hard to keep port numbers straight for multiple projects,
        # so let's assign each project a slot number,
        # and use 8010 + slotnum for the http port,
        # 9010 + slotnum for the slave port, etc.
        # FIXME: get slot from masterjson
        slot = 0
        self.__http_port = 8010 + slot
        self['slavePortnum'] = 9010 + slot

        # SECRETS
        # Avoid checking secrets into git by keeping them in a json file.
        try:
            s = json.load(open(os.path.expanduser(secretsfile)))
            self.__auth = auth.BasicAuth([
                (s["webuser"].encode('ascii', 'ignore'),
                 s["webpass"].encode('ascii', 'ignore'))
            ])
            # For the moment, all slaves have same password
            self.slavepass = s["slavepass"].encode('ascii', 'ignore')
        except:
            exit(
                "%s must be a json file containing webuser, webpass, and slavepass; ascii only, no commas in quotes"
                % secretsfile)

        # STATUS TARGETS
        self['status'] = []
        authz_cfg = authz.Authz(
            # change any of these to True to enable; see the manual for more
            # options
            auth=self.__auth,
            gracefulShutdown=False,
            forceBuild='auth',
            forceAllBuilds=True,
            pingBuilder=True,
            stopBuild=True,
            stopAllBuilds=True,
            cancelPendingBuild=True,
        )
        # Need order_console_by_time for git or hg or any vcs that doesn't have numbered changesets
        self['status'].append(
            html.WebStatus(http_port=self.__http_port,
                           authz=authz_cfg,
                           order_console_by_time=True))

        self['status'].append(
            MailNotifier(fromaddr="*****@*****.**",
                         mode=('problem'),
                         sendToInterestedUsers=True,
                         extraRecipients=['*****@*****.**']))

        # DB URL
        self['db'] = {
            # This specifies what database buildbot uses to store its state.
            # This default is ok for all but the largest installations.
            'db_url': "sqlite:///state.sqlite",
        }

        # PROJECT IDENTITY
        # the 'title' string will appear at the top of this buildbot
        # installation's html.WebStatus home page (linked to the
        # 'titleURL') and is embedded in the title of the waterfall HTML page.

        # FIXME: get name and homepage from masterjson
        self['title'] = name
        self['titleURL'] = homepage

        # the 'buildbotURL' string should point to the location where the buildbot's
        # internal web server (usually the html.WebStatus page) is visible. This
        # typically uses the port number set in the Waterfall 'status' entry, but
        # with an externally-visible host name which the buildbot cannot figure out
        # without some help.

        self['buildbotURL'] = "http://" + socket.gethostname(
        ) + ":%d/" % self.__http_port

        # SLAVES
        self._os2slaves = {}
        self['slaves'] = []
        slaveconfigs = masterjson["slaves"]
        for slaveconfig in slaveconfigs:
            sname = slaveconfig["name"].encode('ascii', 'ignore')
            sos = slaveconfig["os"].encode('ascii', 'ignore')
            # Restrict to a single build at a time because our buildshims
            # typically assume they have total control of machine, and use sudo apt-get, etc. with abandon.
            s = BuildSlave(sname, self.slavepass, max_builds=1)
            self['slaves'].append(s)
            if sos not in self._os2slaves:
                self._os2slaves[sos] = []
            self._os2slaves[sos].append(sname)

        # These will be built up over the course of one or more calls to addSimpleProject
        self['change_source'] = []
        self['builders'] = []
        self['schedulers'] = []

        # Righty-o, wire 'em all up
        for project in masterjson["projects"]:
            self.addSimpleProject(
                project["name"].encode('ascii', 'ignore'),
                project["category"].encode('ascii', 'ignore'),
                project["repourl"].encode('ascii',
                                          'ignore'), project["builders"])
Ejemplo n.º 25
0
 def __init__(self, name, **kwargs):
     password = self.get_pass(name)
     kwargs = self.extract_attrs(name, **kwargs)
     BuildSlave.__init__(self, name, password, **kwargs)
Ejemplo n.º 26
0
def loadBuilderConfig(c, test_mode_is_enabled=False):
    # FIXME: These file handles are leaked.
    if test_mode_is_enabled:
        passwords = make_passwords_json.create_mock_slave_passwords_dict()
    else:
        passwords = json.load(open('passwords.json'))
    results_server_api_key = passwords.get('results-server-api-key')
    if results_server_api_key:
        os.environ['RESULTS_SERVER_API_KEY'] = results_server_api_key

    config = json.load(open('config.json'))
    c['slaves'] = [
        BuildSlave(slave['name'], passwords[slave['name']], max_builds=1)
        for slave in config['slaves']
    ]

    c['schedulers'] = []
    for scheduler in config['schedulers']:
        if "change_filter" in scheduler:
            scheduler["change_filter"] = globals()[scheduler["change_filter"]]
        schedulerType = globals()[scheduler.pop('type')]
        # Python 2.6 can't handle unicode keys as keyword arguments:
        # http://bugs.python.org/issue2646.  Modern versions of json return
        # unicode strings from json.load, so we map all keys to str objects.
        scheduler = dict(
            map(
                lambda key_value_pair:
                (str(key_value_pair[0]), key_value_pair[1]),
                scheduler.items()))

        c['schedulers'].append(schedulerType(**scheduler))

    forceScheduler = ForceScheduler(
        name="force",
        builderNames=[str(builder['name']) for builder in config['builders']],
        reason=StringParameter(name="reason", default="", size=40),

        # Validate SVN revision: number or empty string
        revision=StringParameter(name="revision",
                                 default="",
                                 regex=re.compile(r'^(\d*)$')),

        # Disable default enabled input fields: branch, repository, project, additional properties
        branch=FixedParameter(name="branch"),
        repository=FixedParameter(name="repository"),
        project=FixedParameter(name="project"),
        properties=[
            BooleanParameter(name="is_clean", label="Force Clean build")
        ])
    c['schedulers'].append(forceScheduler)

    c['builders'] = []
    for builder in config['builders']:
        for slaveName in builder['slavenames']:
            for slave in config['slaves']:
                if slave['name'] != slaveName or slave['platform'] == '*':
                    continue

                if slave['platform'] != builder['platform']:
                    raise Exception, "Builder %r is for platform %r but has slave %r for platform %r!" % (
                        builder['name'], builder['platform'], slave['name'],
                        slave['platform'])

                break

        platform = builder['platform']

        builderType = builder.pop('type')
        factory = globals()["%sFactory" % builderType]
        factorykwargs = {}
        for key in "platform", "configuration", "architectures", "triggers", "additionalArguments", "SVNMirror", "device_model":
            value = builder.pop(key, None)
            if value:
                factorykwargs[key] = value

        builder["factory"] = factory(**factorykwargs)

        if platform.startswith('mac'):
            builder["category"] = 'AppleMac'
        elif platform.startswith('ios'):
            builder['category'] = 'iOS'
        elif platform == 'win':
            builder["category"] = 'AppleWin'
        elif platform.startswith('gtk'):
            builder["category"] = 'GTK'
        elif platform.startswith('wpe'):
            builder["category"] = 'WPE'
        elif platform == 'wincairo':
            builder["category"] = 'WinCairo'
        elif platform.startswith('playstation'):
            builder["category"] = 'PlayStation'
        else:
            builder["category"] = 'misc'

        if (builder['category']
                in ('AppleMac', 'AppleWin', 'iOS')) and builderType != 'Build':
            builder['nextBuild'] = pickLatestBuild

        c['builders'].append(builder)
Ejemplo n.º 27
0
	def slaves(self):
		slaves=[]
		for (k,v) in self.pips_archs.iteritems():
			slaves.append(BuildSlave(k,v))
		return slaves
Ejemplo n.º 28
0
# Note that the *same* configuration objects are used for both runs of the
# master.  This is a more strenuous test than strictly required, since a master
# will generally re-execute master.cfg on startup.  However, it's good form and
# will help to flush out any bugs that may otherwise be difficult to find.

c = BuildmasterConfig = {}
from buildbot.buildslave import BuildSlave
from buildbot.changes.filter import ChangeFilter
from buildbot.changes.pb import PBChangeSource
from buildbot.config import BuilderConfig
from buildbot.process.factory import BuildFactory
from buildbot.schedulers.basic import AnyBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.steps.shell import ShellCommand
c['slaves'] = [BuildSlave("local1", "localpw")]
c['slavePortnum'] = 0
c['change_source'] = []
c['change_source'] = PBChangeSource()
c['schedulers'] = []
c['schedulers'].append(
    AnyBranchScheduler(name="all",
                       change_filter=ChangeFilter(project_re='^testy/'),
                       treeStableTimer=1 * 60,
                       builderNames=[
                           'testy',
                       ]))
c['schedulers'].append(ForceScheduler(name="force", builderNames=["testy"]))
f1 = BuildFactory()
f1.addStep(ShellCommand(command='echo hi'))
c['builders'] = []
Ejemplo n.º 29
0
 def __init__(self, configs):
     for config in configs:
         self.append(BuildSlave(config.name, config.password))
Ejemplo n.º 30
0
def loadBuilderConfig(c, is_test_mode_enabled=False):
    # FIXME: These file handles are leaked.
    if is_test_mode_enabled:
        passwords = {}
    else:
        passwords = json.load(open('passwords.json'))
    results_server_api_key = passwords.get('results-server-api-key')
    if results_server_api_key:
        os.environ['RESULTS_SERVER_API_KEY'] = results_server_api_key

    config = json.load(open('config.json'))
    if USE_BUILDBOT_VERSION2:
        c['workers'] = [Worker(worker['name'], passwords.get(worker['name'], 'password'), max_builds=1) for worker in config['workers']]
    else:
        c['slaves'] = [BuildSlave(worker['name'], passwords.get(worker['name'], 'password'), max_builds=1) for worker in config['workers']]

    c['schedulers'] = []
    for scheduler in config['schedulers']:
        if "change_filter" in scheduler:
            scheduler["change_filter"] = globals()[scheduler["change_filter"]]
        schedulerClassName = scheduler.pop('type')
        schedulerClass = globals()[schedulerClassName]
        c['schedulers'].append(schedulerClass(**scheduler))

    forceScheduler = ForceScheduler(
        name="force",
        builderNames=[str(builder['name']) for builder in config['builders']],
        reason=StringParameter(name="reason", default="", size=40),

        # Validate SVN revision: number or empty string
        revision=StringParameter(name="revision", default="", regex=re.compile(r'^(\d*)$')),

        # Disable default enabled input fields: branch, repository, project, additional properties
        branch=FixedParameter(name="branch"),
        repository=FixedParameter(name="repository"),
        project=FixedParameter(name="project"),
        properties=[BooleanParameter(name="is_clean", label="Force Clean build")]
    )
    c['schedulers'].append(forceScheduler)

    c['builders'] = []
    for builder in config['builders']:
        for workerName in builder['workernames']:
            for worker in config['workers']:
                if worker['name'] != workerName or worker['platform'] == '*':
                    continue

                if worker['platform'] != builder['platform']:
                    raise Exception('Builder {} is for platform {} but has worker {} for platform {}!'.format(builder['name'], builder['platform'], worker['name'], worker['platform']))
                break

        if not USE_BUILDBOT_VERSION2:
            builder['slavenames'] = builder.pop('workernames')
        platform = builder['platform']

        factoryName = builder.pop('factory')
        factory = globals()[factoryName]
        factorykwargs = {}
        for key in "platform", "configuration", "architectures", "triggers", "additionalArguments", "device_model":
            value = builder.pop(key, None)
            if value:
                factorykwargs[key] = value

        builder["factory"] = factory(**factorykwargs)

        builder_name = builder['name']
        if len(builder_name) > BUILDER_NAME_LENGTH_LIMIT:
            raise Exception('Builder name "{}" is longer than maximum allowed by Buildbot ({} characters).'.format(builder_name, BUILDER_NAME_LENGTH_LIMIT))
        if not buildbot_identifiers_re.match(builder_name):
            raise Exception('Builder name "{}" is not a valid buildbot identifier.'.format(builder_name))
        for step in builder["factory"].steps:
            if USE_BUILDBOT_VERSION2:
                step_name = step.buildStep().name
            else:
                step_name = step[0].name
            if len(step_name) > STEP_NAME_LENGTH_LIMIT:
                raise Exception('step name "{}" is longer than maximum allowed by Buildbot ({} characters).'.format(step_name, STEP_NAME_LENGTH_LIMIT))
            if not buildbot_identifiers_re.match(step_name):
                raise Exception('step name "{}" is not a valid buildbot identifier.'.format(step_name))

        if platform.startswith('mac'):
            category = 'AppleMac'
        elif platform.startswith('ios'):
            category = 'iOS'
        elif platform == 'win':
            category = 'AppleWin'
        elif platform.startswith('gtk'):
            category = 'GTK'
        elif platform.startswith('wpe'):
            category = 'WPE'
        elif platform == 'wincairo':
            category = 'WinCairo'
        elif platform.startswith('playstation'):
            category = 'PlayStation'
        else:
            category = 'misc'

        if (category in ('AppleMac', 'AppleWin', 'iOS')) and factoryName != 'BuildFactory':
            builder['nextBuild'] = pickLatestBuild

        if USE_BUILDBOT_VERSION2:
            builder['tags'] = getTagsForBuilder(builder)
        else:
            builder['category'] = category
        c['builders'].append(builder)
Ejemplo n.º 31
0
 def prepare(self, passwords):
     BuildSlave.__init__(
         self,
         self.__name,
         self.__password or passwords[self.__name],
         *self.__args, **self.__kw)
Ejemplo n.º 32
0
# ex: set ft=python:

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

####### BUILDSLAVES

# The 'slaves' list defines the set of recognized buildslaves. Each element is
# a BuildSlave object, specifying a unique slave name and password.  The same
# slave name and password must be configured on the slave.
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("forkknet", "password")]

# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
# This must match the value configured into the buildslaves (with their
# --master option)
c['slavePortnum'] = 9989

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes.  Here we point to the buildbot clone of pyflakes.

c['change_source'] = []


####### SCHEDULERS
Ejemplo n.º 33
0
            flags += 'XC_HOST=x86_64-w64-mingw32 '
    #else:
    # We're going to try compiling everything with ccache to speed up buildtimes
    #flags += 'USECCACHE=1 '

    # On OSX, core2 is the minimum MARCH we support
    if name[:3] == "osx":
        march = "core2"

    # On ancient CentOS systems, O_CLOEXEC makes LLVM sad
    # and old cmake has issues linking openssl in libgit2
    if name[:10] == "centos5.11":
        flags += 'DEPS_CXXFLAGS="-DO_CLOEXEC=0" '
        flags += 'CMAKE=cmake28 '

    # Add MARCH to flags
    flags += "MARCH=%s " % (march)
    c['slaves'] += [
        BuildSlave(name,
                   'julialang42',
                   max_builds=1,
                   properties={
                       'deb_arch': deb_arch,
                       'tar_arch': tar_arch,
                       'release': name,
                       'flags': flags,
                       'up_arch': up_arch,
                       'bits': bits
                   })
    ]
Ejemplo n.º 34
0
            c['slaves'].append(slave)
    else:
        for index, password in enumerate(slaveConfig['passwords']):
            name = '%s/%d' % (base, index)
            if 'aws/rhel-7.2' in base:
                # Use AWS RHEL buildslave as AWS CentOS buildslave.
                if 'aws/centos-7' not in SLAVENAMES:
                    SLAVENAMES['aws/centos-7'] = [name]
                else:
                    SLAVENAMES['aws/centos-7'].append(name)
            else:
                SLAVENAMES[base] = [name]
            c['slaves'].append(
                BuildSlave(
                    name,
                    password=password,
                    max_builds=slaveConfig.get('max_builds'),
                ))

# A codebase generator synthesizes an internal identifier from a ... change.
# The codebase identifier lets parts of the build configuration more easily
# inspect attributes of the change without ambiguity when there are potentially
# multiple change sources (eg, multiple repositories being fetched for a single
# build).

FLOCKER_REPOSITORY = "[email protected]:ClusterHQ/flocker.git"

CODEBASES = {
    FLOCKER_REPOSITORY: "flocker",
    "https://github.com/ClusterHQ/flocker": "flocker",
}
Ejemplo n.º 35
0
 def __init__(self, name, **kwargs):
     password = self.get_password(name)
     BuildSlave.__init__(self, name, password, **kwargs)