2013-05-14 06:10:00 +00:00
|
|
|
import os
|
|
|
|
from buildbot.buildslave import BuildSlave
|
|
|
|
from buildbot.schedulers.forcesched import ForceScheduler
|
|
|
|
from buildbot.schedulers.basic import SingleBranchScheduler
|
|
|
|
from buildbot.changes import filter
|
|
|
|
from buildbot.config import BuilderConfig
|
|
|
|
from buildbot.process.factory import BuildFactory
|
2013-07-05 03:28:54 +00:00
|
|
|
from buildbot.process.properties import Interpolate
|
2013-05-14 06:10:00 +00:00
|
|
|
from buildbot.steps.shell import ShellCommand
|
2013-07-05 04:43:46 +00:00
|
|
|
from buildbot.status import html, words
|
2013-05-14 06:10:00 +00:00
|
|
|
from buildbot.status.web import authz, auth
|
2013-07-05 04:43:46 +00:00
|
|
|
from buildbot.status.mail import MailNotifier
|
2013-05-14 06:10:00 +00:00
|
|
|
|
|
|
|
PORT_WEB = 80 # Buildbot webserver port
|
|
|
|
PORT_GITHUB = 8011 # Buildbot github hook port
|
|
|
|
PORT_MASTER = 9989 # Port where buildbot master listen buildworkers
|
|
|
|
TEST_USER = 'buildbot' # Credential to authenticate build triggers
|
|
|
|
TEST_PWD = 'docker' # Credential to authenticate build triggers
|
|
|
|
BUILDER_NAME = 'docker'
|
2013-07-05 03:28:54 +00:00
|
|
|
GITHUB_DOCKER = 'github.com/dotcloud/docker'
|
|
|
|
DOCKER_PATH = '/data/docker'
|
|
|
|
BUILDER_PATH = '/data/buildbot/slave/{0}/build'.format(BUILDER_NAME)
|
2013-05-14 06:10:00 +00:00
|
|
|
DOCKER_BUILD_PATH = BUILDER_PATH + '/src/github.com/dotcloud/docker'
|
2013-07-05 04:43:46 +00:00
|
|
|
|
|
|
|
# Credentials set by setup.sh and Vagrantfile
|
|
|
|
BUILDBOT_PWD = ''
|
|
|
|
IRC_PWD = ''
|
|
|
|
IRC_CHANNEL = ''
|
|
|
|
SMTP_USER = ''
|
|
|
|
SMTP_PWD = ''
|
|
|
|
EMAIL_RCP = ''
|
2013-05-14 06:10:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
c = BuildmasterConfig = {}
|
|
|
|
|
|
|
|
c['title'] = "Docker"
|
|
|
|
c['titleURL'] = "waterfall"
|
2013-07-05 03:28:54 +00:00
|
|
|
c['buildbotURL'] = "http://docker-ci.dotcloud.com/"
|
2013-05-14 06:10:00 +00:00
|
|
|
c['db'] = {'db_url':"sqlite:///state.sqlite"}
|
2013-07-05 03:28:54 +00:00
|
|
|
c['slaves'] = [BuildSlave('buildworker', BUILDBOT_PWD)]
|
2013-05-14 06:10:00 +00:00
|
|
|
c['slavePortnum'] = PORT_MASTER
|
|
|
|
|
|
|
|
c['schedulers'] = [ForceScheduler(name='trigger',builderNames=[BUILDER_NAME])]
|
|
|
|
c['schedulers'].append(SingleBranchScheduler(name="all",
|
|
|
|
change_filter=filter.ChangeFilter(branch='master'),treeStableTimer=None,
|
|
|
|
builderNames=[BUILDER_NAME]))
|
|
|
|
|
|
|
|
# Builder
|
|
|
|
factory = BuildFactory()
|
2013-07-05 03:28:54 +00:00
|
|
|
factory.addStep(ShellCommand(description='Docker',logEnviron=False,usePTY=True,
|
|
|
|
command=["sh", "-c", Interpolate("cd ..; rm -rf build; export GOPATH={0}; "
|
|
|
|
"go get -d {1}; cd {2}; git reset --hard %(src::revision:-unknown)s; "
|
|
|
|
"go test -v".format(BUILDER_PATH,GITHUB_DOCKER,DOCKER_BUILD_PATH))]))
|
2013-05-14 06:10:00 +00:00
|
|
|
c['builders'] = [BuilderConfig(name=BUILDER_NAME,slavenames=['buildworker'],
|
|
|
|
factory=factory)]
|
|
|
|
|
|
|
|
# Status
|
2013-07-05 04:43:46 +00:00
|
|
|
authz_cfg = authz.Authz(auth=auth.BasicAuth([(TEST_USER, TEST_PWD)]),
|
2013-05-14 06:10:00 +00:00
|
|
|
forceBuild='auth')
|
|
|
|
c['status'] = [html.WebStatus(http_port=PORT_WEB, authz=authz_cfg)]
|
2013-07-05 04:43:46 +00:00
|
|
|
c['status'].append(html.WebStatus(http_port=PORT_GITHUB, allowForce=True,
|
|
|
|
change_hook_dialects={ 'github': True }))
|
|
|
|
c['status'].append(MailNotifier(fromaddr='buildbot@docker.io',
|
|
|
|
sendToInterestedUsers=False, extraRecipients=[EMAIL_RCP],
|
|
|
|
mode='failing', relayhost='smtp.mailgun.org', smtpPort=587, useTls=True,
|
|
|
|
smtpUser=SMTP_USER, smtpPassword=SMTP_PWD))
|
|
|
|
c['status'].append(words.IRC("irc.freenode.net", "dockerqabot",
|
|
|
|
channels=[IRC_CHANNEL], password=IRC_PWD, allowForce=True,
|
|
|
|
notify_events={'exception':1, 'successToFailure':1, 'failureToSuccess':1}))
|