This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/buildman/builder.py

47 lines
1.4 KiB
Python
Raw Normal View History

import logging
import os
import features
from app import app, userfiles as user_files, build_logs, dockerfile_build_queue
from buildman.manager.enterprise import EnterpriseManager
from buildman.server import BuilderServer
from trollius import SSLContext
2014-11-18 20:45:56 +00:00
LOGGER = logging.getLogger(__name__)
BUILD_MANAGERS = {
'enterprise': EnterpriseManager
}
def run_build_manager():
if not features.BUILD_SUPPORT:
LOGGER.debug('Building is disabled. Please enable the feature flag')
return
build_manager_config = app.config.get('BUILD_MANAGER')
if build_manager_config is None:
return
LOGGER.debug('Asking to start build manager with lifecycle "%s"', build_manager_config[0])
manager_klass = BUILD_MANAGERS.get(build_manager_config[0])
if manager_klass is None:
return
LOGGER.debug('Starting build manager with lifecycle "%s"', build_manager_config[0])
ssl_context = None
if os.environ.get('SSL_CONFIG'):
LOGGER.debug('Loading SSL cert and key')
ssl_context = SSLContext()
ssl_context.load_cert_chain(os.environ.get('SSL_CONFIG') + '/ssl.cert',
os.environ.get('SSL_CONFIG') + '/ssl.key')
server = BuilderServer(app.config['SERVER_HOSTNAME'], dockerfile_build_queue, build_logs,
user_files, manager_klass)
server.run('0.0.0.0', ssl=ssl_context)
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
run_build_manager()