Buildbot: Require user auth for forcing builds

This commit is contained in:
Mitchell Hashimoto 2011-11-12 16:09:30 -08:00
parent c0f3e6b954
commit 5d98c5cab7
2 changed files with 21 additions and 9 deletions

View File

@ -16,6 +16,7 @@ c.define('title_url', type=str, help="URL for title page")
c.define('buildbot_url', type=str, help="URL to the buildbot master.")
c.define('slaves', type=str, help="A list of the slave machines. The format should be name:password,name:password,...")
c.define('web_port', type=int, help="Port to listen on for web service.")
c.define('http_users', type=str, help="username:password list of users.")
#----------------------------------------------------------------------
# Load the Settings

View File

@ -5,26 +5,37 @@ buildbot master.
from buildbot.status import html
from buildbot.status.web.authz import Authz
from buildbot.status.web.auth import BasicAuth
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(
gracefulShutdown = True,
forceBuild = True,
forceAllBuilds = True,
auth = BasicAuth(auth_users),
gracefulShutdown = False,
forceBuild = 'auth',
forceAllBuilds = 'auth',
pingBuilder = True,
stopBuild = True,
stopAllBuilds = True,
cancelPendingBuild = True,
stopChange = True,
cleanShutdown= True
stopBuild = 'auth',
stopAllBuilds = 'auth',
cancelPendingBuild = 'auth',
stopChange = 'auth',
cleanShutdown= False
)
web_status = html.WebStatus(
http_port = options.web_port,
authz = Authz(),
authz = authz,
order_console_by_time = True,
change_hook_dialects=dict(github=True)
)