Exemplo n.º 1
0
def setup(c, config):
    c["status"] = []

    authz_cfg = authz.Authz(forceBuild=True,
                            forceAllBuilds=True,
                            stopBuild=True,
                            stopAllBuilds=True,
                            cancelPendingBuild=True,
                            stopChange=True)

    c["status"].append(html.WebStatus(http_port=config["web_port"],
                                      authz=authz_cfg,
                                      change_hook_dialects={"base": True}))

    c["status"].append(words.IRC(host="irc.freenode.net",
                                 nick="sbbot",
                                 channels=["#sugar"],
                                 categories=["upstream"],
                                 notify_events={"successToFailure": 1,
                                                "failureToSuccess": 1}))

    c["status"].append(MailNotifier(fromaddr="*****@*****.**",
                                    mode=["problem"],
                                    lookup="sugarlabs.org",
                                    categories=["upstream"],
                                    extraRecipients=["*****@*****.**"]))

    c["status"].append(HttpStatusPush(serverUrl=str(config["status_url"])))
Exemplo n.º 2
0
def WebStatus(cfg):
    ldap_conf = cfg.get('ldap')
    ldap = ldapauth.LDAPAuth(ldap_conf['host'],
                             ldap_conf['basedn'],
                             groupdn=ldap_conf['groupdn'],
                             search=ldap_conf['search'])

    master_admins = cfg.get('master-admins')
    slave_admins = master_admins + cfg.get('slave-admins')

    auth = amauthz.AMAuthz(auth=ldap,
                           forceBuild='auth',
                           forceAllBuilds='auth',
                           pingBuilder='auth',
                           stopBuild='auth',
                           stopAllBuilds='auth',
                           cancelPendingBuild='auth',
                           gracefulShutdown=lambda u, s: u in slave_admins,
                           cleanShutdown=lambda u: u in master_admins)
    auth.setCookiePath(cfg.get('url-path'))

    web_conf = cfg.get('web')
    web_args = {}
    if 'github' in web_conf:
        web_args['change_hook_dialects'] = {'github': {}}
        web_args['change_hook_auth'] = ['file:{0}'.format(web_conf['github'])]

    return html.WebStatus(http_port='tcp:{0}'.format(web_conf['port']),
                          authz=auth,
                          **web_args)
Exemplo n.º 3
0
def get_web():
    from buildbot.status import html
    from buildbot.status.web import authz, auth
    import users

    users = users.get_users()

    authz_cfg = authz.Authz(auth=auth.BasicAuth(users),
                            view=True,
                            forceBuild='auth',
                            forceAllBuilds='auth',
                            pingBuilder='auth',
                            gracefulShutdown=False,
                            pauseSlave='auth',
                            stopBuild='auth',
                            stopAllBuilds='auth',
                            cancelPendingBuild='auth',
                            cancelAllPendingBuilds='auth',
                            stopChange='auth',
                            cleanShutdown=False,
                            showUsersPage='auth')

    return html.WebStatus(http_port="tcp:8010:interface=127.0.0.1",
                          authz=authz_cfg,
                          change_hook_dialects={
                              'base': True,
                              'github': {}
                          },
                          change_hook_auth=['file:changehook.passwd'])
Exemplo n.º 4
0
def get_status(options):
    """
    Returns a list of status targets for the build master.
    """
    # Load the users that are allowed to perform authenticated
    # actions from the configuration
    auth_users = []
    if options.http_users is not None:
        for pair in options.http_users.split(","):
            user, password = pair.split(":")
            auth_users.append((user, password))

    # Setup the rules for who can do what to the WebStatus
    authz = Authz(auth=BasicAuth(auth_users),
                  gracefulShutdown=False,
                  forceBuild='auth',
                  forceAllBuilds='auth',
                  pingBuilder=True,
                  stopBuild='auth',
                  stopAllBuilds='auth',
                  cancelPendingBuild='auth',
                  stopChange='auth',
                  cleanShutdown=False)

    # The web status gives us the nice web interface to our buildbot
    web_status = html.WebStatus(http_port=options.web_port,
                                authz=authz,
                                order_console_by_time=True,
                                change_hook_dialects=dict(github=True))

    # Hook up an IRC bot into our channel
    irc = words.IRC("irc.freenode.net",
                    "vagrant-ci",
                    channels=[{
                        "channel": "#vagrant"
                    }],
                    notify_events={
                        'exception': 1,
                        'successToFailure': 1,
                        'failureToSuccess': 1
                    })

    return [web_status, irc]
Exemplo n.º 5
0
def get_status():
    status = []
    authz_cfg=authz.Authz(
        # change any of these to True to enable; see the manual for more
        # options
        gracefulShutdown = False,
        forceBuild = True, # use this to test your slave once it is set up
        forceAllBuilds = False,
        pingBuilder = False,
        stopBuild = False,
        stopAllBuilds = False,
        cancelPendingBuild = False,
    )
    status.append(html.WebStatus(http_port=8010, authz=authz_cfg))


    mn = MailNotifier(fromaddr="*****@*****.**", 
                      sendToInterestedUsers=False, mode='all',
                      extraRecipients=['*****@*****.**'],
                      useTls=True, relayhost="smtp.gmail.com", smtpPort=587, smtpUser="******", smtpPassword="******")
    status.append(mn)
    return status
    def _getWeb(self):
        """
        Return a web status based on configuration.
        """
        configuration = self._raw['web']
        http_port = configuration.get('port', 8000)
        htpasswd_path = configuration.get('htpasswd', 'no-such-file')
        authz_kwargs = configuration.get('authorization', {})

        htpasswd_auth = None
        try:
            htpasswd_auth = HTPasswdAuth(htpasswd_path)
        except AssertionError:
            # Don't use authentication if we can not open the file... mainly
            # useful for testing.
            print '!!!WARNING!!! Failed to find the password file.'
            print 'Starting with NO authentication.'
            htpasswd_auth = None

        authz_kwargs['auth'] = htpasswd_auth
        authz_cfg = authz.Authz(**authz_kwargs)

        return html.WebStatus(http_port=http_port, authz=authz_cfg)
Exemplo n.º 7
0
status = []

users = [('dev', 'bbot!')  # it's not *that* secret..
         ]

authz = Authz(auth=BasicAuth(users),
              forceBuild='auth',
              forceAllBuilds='auth',
              gracefulShutdown='auth')

status.append(
    html.WebStatus(
        # localhost is not available in the jail
        http_port="tcp:8010:interface=192.168.80.239",
        authz=authz,
        order_console_by_time=True,
        revlink="http://github.com/buildbot/buildbot/commit/%s",
        changecommentlink=(r'\b#(\d+)\b',
                           r'http://buildbot.net/trac/ticket/\1',
                           r'Ticket \g<0>'),
        change_hook_dialects={'github': {}}))

status.append(
    words.IRC(host="irc.freenode.net",
              nick="bb-meta",
              notify_events={
                  'successToFailure': 1,
                  'failureToSuccess': 1
              },
              channels=["#buildbot"]))
Exemplo n.º 8
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"])
Exemplo n.º 9
0
from buildbot.status import html
from buildbot.status.web.authz import Authz
from buildbot.status.web.auth import BasicAuth
from buildbot import revlinks

users = [('dev', 'bbot!')]  # it's not *that* secret..
authz = Authz(
    auth=BasicAuth(users),
    forceBuild='auth',
)

revlink = revlinks.RevlinkMatch([r'git://github.com/(.*)/(.*)'],
                                r'https://github.com/\1/\2/commit/%s')

status.append(
    html.WebStatus(
        http_port=8010,
        authz=authz,
        order_console_by_time=True,
        change_hook_dialects={'github': True},
    ))

# from buildbot.status import words
# status.append(words.IRC(host="irc.oftc.net", nick="institute-bb",
# 				notify_events={
# 					'successToFailure' : 1,
# 					'failureToSuccess' : 1,
# 				},
#                               channels=["#institute"]))
Exemplo n.º 10
0
c['status'] = []

from buildbot.status import html
from buildbot.status.web import authz, auth

authz_cfg = authz.Authz(
    auth=auth.BasicAuth([(config.AUTH_USER, config.AUTH_PSW)]),
    gracefulShutdown=False,
    forceBuild='auth',
    forceAllBuilds=False,
    pingBuilder=False,
    stopBuild=False,
    stopAllBuilds=False,
    cancelPendingBuild=False,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))

####### MAIL NOTIFIER

from buildbot.status.mail import MailNotifier
from buildbot.status.builder import Results


def messageFormatter(mode, name, build, results, master_status):
    result = Results[results]
    text = list()
    text.append("STATUS: %s" % result.title())
    if results == 0:
        text.append(open('../changes/{}changes.log'.format(name), 'r').read())
    build_url = 'Read more: {}:{}/builders/{}/builds/{}'.format(
        config.BUILDBOT_HOST, config.BUILDBOT_PORT, name, build.getNumber())
Exemplo n.º 11
0
status = []

authz_cfg=authz.Authz(
    # change any of these to True to enable; see the manual for more options
    gracefulShutdown = False,
    forceBuild = True, # use this to test your slave once it is set up
    forceAllBuilds = False,
    pingBuilder = False,
    stopBuild = False,
    stopAllBuilds = False,
    cancelPendingBuild = False,
)
status.append(html.WebStatus(
    http_port = 8080,
    authz = authz_cfg,
    change_hook_dialects = { 'github' : True }
))


def get_smtp_password():
    path = os.path.join(os.path.dirname(__file__), "passwords/smtp")
    pw = open(path).read().strip()
    return pw

status.append(mail.MailNotifier(
    fromaddr = "*****@*****.**",
    sendToInterestedUsers = False,
    extraRecipients = [ "*****@*****.**" ],
    useTls = True, relayhost = "smtp.gmail.com", smtpPort = 587,
    smtpUser = "******", smtpPassword = get_smtp_password(),
Exemplo n.º 12
0
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.changes.filter import ChangeFilter
from buildbot.process.factory import BuildFactory
from buildbot.steps.shell import ShellCommand
from buildbot.config import BuilderConfig
from buildbot.status import html
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'] = []
c['builders'].append(
    BuilderConfig(name="testy", slavenames=["local1"], factory=f1))
c['status'] = []
c['status'].append(html.WebStatus(http_port=0))
c['title'] = "test"
c['titleURL'] = "test"
c['buildbotURL'] = "http://localhost:8010/"
c['db'] = {'db_url': "sqlite:///state.sqlite"}
Exemplo n.º 13
0
 'protocols': {
     'pb': {
         'port': cybertron['devastator_slave_port']
     }
 },
 'builders':
 all_builders,
 'schedulers':
 all_schedulers,
 'status': [
     html.WebStatus(cybertron['devastator_master_port'],
                    authz=authz.Authz(view=True,
                                      forceBuild=True,
                                      forceAllBuilds=True,
                                      pingBuilder=True,
                                      stopBuild=True,
                                      stopAllBuilds=True,
                                      cancelPendingBuild=True,
                                      cancelAllPendingBuilds=True,
                                      stopChange=True,
                                      showUsersPage=True))
 ],
 'codebaseGenerator':
 lambda chdict: chdict['repository'],
 'change_source':
 change_sources,
 'mergeRequests':
 False,
 'debugPassword':
 '******',
 'changeHorizon':
Exemplo n.º 14
0
####### STATUS TARGETS

# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.

from buildbot.status import html
from buildbot.status.web import authz, auth
from irc import ExtendedIRC
from nightly import ShutdownIdleSlaves

authz_cfg = authz.Authz(auth=auth.BasicAuth([("%%WEB-USERNAME%%",
                                              "%%WEB-PASSWORD%%")]),
                        default_action='auth')
status_web = html.WebStatus(authz=authz_cfg, http_port=8010)
status_irc = ExtendedIRC(
    host="irc.dairc.net",
    port=6697,
    useSSL=True,
    useRevisions=True,
    nick="eA-BuildBot",
    password="******",
    channels=["#Athena"],
    notify_events={
        #'started': 1,
        #'finished': 1,
        #'success': 1,
        'failure': 1,
    },
    allowForce=True)
Exemplo n.º 15
0
        BuildSlave("win32", schat_passwords.WIN32),
        BuildSlave("macosx", schat_passwords.MACOSX),
        BuildSlave("master", schat_passwords.MASTER),
        BuildSlave("precise", schat_passwords.PRECISE),
        BuildSlave("precise64", schat_passwords.PRECISE64),
    ],
    'change_source': [
        SVNPoller(
            svnurl="https://schat.googlecode.com/svn",
            split_file=split_file_branches,
            pollinterval=60,
        ),
    ],
    'status': [
        html.WebStatus(
            http_port="tcp:8010:interface=127.0.0.1",
            authz=authz,
            revlink='http://code.google.com/p/schat/source/detail?r=%s'),
    ],
    'db': {
        'db_url': "sqlite:///state.sqlite",
    }
}

c['properties'] = {
    'version': SCHAT_VERSION,
    'version_legacy': SCHAT_VERSION_LEGACY,
    'suffix': '-dev',
}

c['schedulers'] = [
    ForceScheduler(name='force',
Exemplo n.º 16
0
from buildbot.status.web import authz, auth
from buildbot.status import words

authz_cfg=authz.Authz(
    # change any of these to True to enable; see the manual for more
    # options
    auth=auth.BasicAuth([("forkk", "password")]),
    gracefulShutdown = False,
    forceBuild = 'auth', # use this to test your slave once it is set up
    forceAllBuilds = False,
    pingBuilder = False,
    stopBuild = False,
    stopAllBuilds = False,
    cancelPendingBuild = False,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg,
                                  change_hook_dialects={"github": True}))


####### 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.

c['title'] = "Forkk.net Website"
c['titleURL'] = "https://github.com/Forkk/forkk.net"

# 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
Exemplo n.º 17
0
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description:
#
#

from buildbot.status import html, mail, words

web = html.WebStatus(http_port=8010)

allBuildsEmail = mail.MailNotifier(
    fromaddr="*****@*****.**",
    extraRecipients=["*****@*****.**"],
    sendToInterestedUsers=False)
breakageEmail = mail.MailNotifier(fromaddr="*****@*****.**",
                                  lookup=mail.Domain("webkit.org"),
                                  mode="failing")

IRC = words.IRC(
    host="irc.freenode.net",
    nick="webkit-build",
    channels=["#webkit-build"],
    #                announceAllBuilds=True
)
Exemplo n.º 18
0
 def Config(self):
     return {
         'projectName':
         "Clementine",
         'projectURL':
         "http://www.clementine-player.org/",
         'buildbotURL':
         "http://buildbot.clementine-player.org/",
         'slavePortnum':
         9989,
         'slaves':
         self.slaves,
         'builders':
         self.builders,
         'change_source': [
             builders.GitPoller("Android-Remote"),
             builders.GitPoller("Clementine"),
             builders.GitPoller("Dependencies"),
             builders.GitPoller("Website"),
         ],
         'status': [
             html.WebStatus(
                 http_port="tcp:8010",
                 authz=authz.Authz(
                     forceBuild=True,
                     forceAllBuilds=True,
                     stopBuild=True,
                     stopAllBuilds=True,
                     cancelPendingBuild=True,
                     cancelAllPendingBuilds=True,
                     stopChange=True,
                 ),
             ),
             mail.MailNotifier(
                 fromaddr="*****@*****.**",
                 lookup="gmail.com",
                 mode="failing",
             ),
         ],
         'schedulers': [
             basic.SingleBranchScheduler(
                 name="automatic",
                 change_filter=filter.ChangeFilter(project="clementine",
                                                   branch="master"),
                 treeStableTimer=2 * 60,
                 builderNames=self.auto_builder_names,
             ),
             basic.SingleBranchScheduler(
                 name="dependencies",
                 change_filter=filter.ChangeFilter(project="dependencies",
                                                   branch="master"),
                 treeStableTimer=2 * 60,
                 builderNames=[
                     'Mac Dependencies',
                     'Windows Dependencies',
                 ],
             ),
             basic.SingleBranchScheduler(
                 name="website",
                 change_filter=filter.ChangeFilter(project="website",
                                                   branch="master"),
                 treeStableTimer=2 * 60,
                 builderNames=[
                     "Transifex website POT push",
                 ],
             ),
             basic.SingleBranchScheduler(
                 name="android-remote",
                 change_filter=filter.ChangeFilter(project="android-remote",
                                                   branch="master"),
                 treeStableTimer=2 * 60,
                 builderNames=[
                     "Android Remote",
                 ],
             ),
             forcesched.ForceScheduler(
                 name="force",
                 reason=forcesched.FixedParameter(name="reason",
                                                  default="force build"),
                 branch=forcesched.StringParameter(name="branch",
                                                   default="master"),
                 revision=forcesched.FixedParameter(name="revision",
                                                    default=""),
                 repository=forcesched.FixedParameter(name="repository",
                                                      default=""),
                 project=forcesched.FixedParameter(name="project",
                                                   default=""),
                 properties=[],
                 builderNames=[x['name'] for x in self.builders],
             ),
             timed.Nightly(
                 name="transifex_pull",
                 change_filter=filter.ChangeFilter(project="clementine",
                                                   branch="master"),
                 hour=10,
                 minute=0,
                 dayOfWeek=0,
                 branch="master",
                 builderNames=[
                     "Transifex PO pull",
                     "Transifex website PO pull",
                     "Transifex Android PO pull",
                 ],
             ),
         ],
     }
Exemplo n.º 19
0
from buildbot.status import html, words
from buildbot.status.web import authz, auth
from config import users

authz_cfg = authz.Authz(
    auth=auth.BasicAuth(users),
    gracefulShutdown=False,
    forceBuild='auth',
    forceAllBuilds='auth',
    pingBuilder='auth',
    stopBuild='auth',
    stopAllBuilds='auth',
    cancelPendingBuild='auth')

www_status = html.WebStatus(http_port=8010, authz=authz_cfg,
                            change_hook_dialects={'github': True})

irc_status = words.IRC(host="irc.freenode.net", nick="p3dbuildbot",
                       channels=["#panda3d-devel"], notify_events={
                           'exception': True,
                           'failureToSuccess': True,
                           'successToFailure': True})

# Fix the stupid github hook... I submitted a patch to buildbot for this.
# This should be fixed in buildbot 0.8.11.
from buildbot.status.web.hooks import github
import change_hook
github.getChanges = change_hook.getChanges
github.process_change = change_hook.process_change