Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- python -*-
- # ex: set syntax=python:
- import cgi, datetime, jinja2, buildbot.status.client, re
- from os.path import basename, dirname
- from sets import Set
- from buildbot.changes import filter
- from buildbot.changes.gitpoller import GitPoller
- from buildbot.config import BuilderConfig
- from buildbot.plugins import reporters
- from buildbot.plugins import steps
- from buildbot.plugins import util
- from buildbot.plugins import worker
- from buildbot.process.build import Build
- from buildbot.process.factory import BuildFactory
- from buildbot.process.properties import Property, Interpolate
- from buildbot.schedulers import timed
- from buildbot.schedulers.basic import SingleBranchScheduler
- from buildbot.schedulers.forcesched import ForceScheduler
- from buildbot.schedulers.trysched import Try_Userpass
- from buildbot.status.builder import Results
- from buildbot.www.authz import Authz
- from buildbot.steps.source.git import Git
- from buildbot.steps.shell import Compile, ShellCommand, SetPropertyFromCommand
- from buildbot.steps.transfer import FileUpload
- # This is the dictionary that the buildmaster pays attention to. We also use
- # a shorter alias to save typing.
- c = BuildmasterConfig = {}
- # The 'services' list used mainly to add reporters.
- c['services'] = []
- # The 'workers' list defines the slaves available.
- c['workers'] = []
- # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
- # what steps, and which workers can execute them. Note that any particular build will
- # only take place on one worker.
- c['builders'] = []
- # The schedulers configuration parameter gives a list of Scheduler instances, each of
- # which causes builds to be started on a particular set of Builders.
- c['schedulers'] = []
- # the 'change_source' setting tells the buildmaster how it should find out
- # about source code changes.
- c['change_source'] = []
- # 'protocols' contains information about protocols which master will use for
- # communicating with workers. You must define at least 'port' option that workers
- # could connect to your master with this protocol.
- # 'port' must match the value configured into the workers (with their
- # --master option)
- c['protocols'] = {'pb': {'port': 9990}}
- # 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.
- c['title'] = "Linux"
- c['titleURL'] = "http://www.kernel.org/"
- # 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.
- c['buildbotURL'] = "http://bmaster-1.company.com:8000/"
- # 'db' specifies what databases buildbot uses to store its state. You can leave
- # this at its default for all but the largest installations.
- c['db'] = { "db_url":"sqlite:///state.sqlite" }
- # Memory management
- # We do have our own script to clean up build logs
- c['buildHorizon'] = 0 # Keep the last 0 builds in the disk
- c['logHorizon'] = 0 # Keep the 0 most recent build logs in the disk
- c['logMaxSize'] = 5 * 1024 * 1024 # 5MB log should be enough to debug the problem
- c['logMaxTailSize'] = 32768 # Shouldn't be too high as it is kept in memory
- # Caches
- c['caches'] = {
- 'Changes' : 1000, # For huge merges
- 'Builds' : 2, # Just cache the last 2 builds
- 'chdicts' : 1000, # == Changes
- 'BuildRequests' : 10,
- 'SourceStamps' : 10,
- 'ssdicts' : 10,
- 'objectids' : 10,
- 'usdicts' : 10,
- }
- ######## SMTP credentials ########################
- smtp_from = "valid.address@company.com"
- smtp_host = "valid.smtp.server@company.com"
- smtp_port = 587
- smtp_user = "valid.user"
- smtp_pass = "valid.pass"
- smtp_tls = True
- ####### WORKERS
- myworkerlist=[]
- # workers
- c['workers'].append(
- worker.Worker("bworker-1",
- "valid.master.pass",
- max_builds=1,
- notify_on_missing=["problem.solvers@company.com"],
- missing_timeout=1200
- )
- )
- myworkerlist.append("bworker-1")
- ####### BUILDERS ################################
- builders_we_care_about = []
- ####### GIT POLLERS REPOS ########################
- gitpollers_repos = {}
- ####################################################################
- #
- # BEGIN mainline
- #
- ####################################################################
- mainline_recipients = ["vincent@company.com"]
- mainline_factories = {}
- mainline_builders = []
- class MainlineBuildFactory(BuildFactory):
- def __init__(self):
- BuildFactory.__init__(self)
- self.buildClass = Build
- # Clean workdir
- self.addStep(
- ShellCommand(
- command = Interpolate("rm -Rf %(prop:workdir)s"),
- name = "Initial cleanup",
- timeout = 3600,
- maxTime = 14400,
- haltOnFailure = True
- )
- )
- c['builders'].append(
- BuilderConfig(
- name = "Mainline",
- workernames = myworkerlist,
- factory = MainlineBuildFactory()
- )
- )
- mainline_builders.append(name)
- builders_we_care_about.append(name)
- c['services'].append(
- reporters.MailNotifier(
- fromaddr = smtp_from,
- relayhost = smtp_host,
- smtpPort = smtp_port,
- smtpUser = smtp_user,
- smtpPassword = smtp_pass,
- useTls = smtp_tls,
- extraRecipients = mainline_recipients,
- sendToInterestedUsers = False,
- builders = mainline_builders,
- mode = "passing",
- buildSetSummary = True
- )
- )
- c['services'].append(
- reporters.MailNotifier(
- fromaddr = smtp_from,
- relayhost = smtp_host,
- smtpPort = smtp_port,
- smtpUser = smtp_user,
- smtpPassword = smtp_pass,
- useTls = smtp_tls,
- extraRecipients = mainline_recipients,
- sendToInterestedUsers = False,
- builders = mainline_builders,
- mode = "failing"
- )
- )
- ####################################################################
- #
- # END mainline
- #
- ####################################################################
- ####### GOBAL SCHEDULERS ################################
- # Add a ForceScheduler and allow all our builders to use it.
- c['schedulers'].append(
- ForceScheduler(
- name = "force-scheduler",
- builderNames = builders_we_care_about
- )
- )
- ####### WEB INTERFACE ######################################
- # Custom templates that will be used instead of the default ones
- myloaders = [ jinja2.FileSystemLoader(dirname(__file__) + "/templates") ]
- # Set the web status
- c['www'] = {
- 'port': 8000,
- 'plugins': {
- 'waterfall_view': {},
- 'console_view': {}
- },
- }
- # Web UI authentication information
- authz = Authz(
- allowRules = [
- util.AnyControlEndpointMatcher(role = "admins")
- ],
- roleMatchers = [
- util.RolesFromUsername(roles = ['admins'], usernames = ['admin.username'])
- ]
- )
- auth = util.UserPasswordAuth({'admin.username':'admin.pass'})
- c['www']['auth'] = auth
- c['www']['authz'] = authz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement