diff --git a/etc/kolla/kolla-build.conf b/etc/kolla/kolla-build.conf index 537351bfb6..468641ce07 100644 --- a/etc/kolla/kolla-build.conf +++ b/etc/kolla/kolla-build.conf @@ -36,15 +36,23 @@ # Turn on debugging log level #debug = False -# Path to custome file to be addded at beginning of base Dockerfile +# Path to custom file to be addded at beginning of base Dockerfile #include_header = /path/to/header_file -# Path to custome file to be addded at end of Dockerfiles for final images +# Path to custom file to be addded at end of Dockerfiles for final images #include_footer = /path/to/footer_file # The registry host. The default registry host is Docker Hub. #registry = None + +# Preset build profiles can be set here to easily build common sets of images +[profiles] +infra = ceph,data,mariadb,haproxy,keepalived,kolla-ansible,memcached,mongodb,openvswitch,rabbitmq +main = cinder,ceilometer,glance,heat,horizon,keystone,neutron,nova,swift +aux = designate,gnocchi,ironic,magnum,zaqar +default = data,kolla-ansible,glance,haproxy,heat,horizon,keystone,memcached,mariadb,neutron,nova,rabbitmq + # Provide location of sources for source install builds. # Example: # diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py index 55969c9bd2..94da59e6f6 100755 --- a/kolla/cmd/build.py +++ b/kolla/cmd/build.py @@ -289,6 +289,14 @@ def merge_args_and_config(settings_from_config_file): parser.add_argument('--registry', help=("the docker registry host"), type=str) + parser.add_argument('-p', '--profile', + help=('Build a pre-defined set of images, see ' + '[profiles] section in ' + '{}'.format( + find_config_file('kolla-build.conf'))), + type=str, + action='append') + return vars(parser.parse_args()) @@ -323,6 +331,7 @@ class KollaWorker(object): self.include_header = config['include_header'] self.include_footer = config['include_footer'] self.regex = config['regex'] + self.profile = config['profile'] self.source_location = ConfigParser.SafeConfigParser() self.source_location.read(find_config_file('kolla-build.conf')) self.image_statuses_bad = dict() @@ -387,8 +396,27 @@ class KollaWorker(object): def filter_images(self): """Filter which images to build""" + filter_ = list() + if self.regex: - patterns = re.compile(r"|".join(self.regex).join('()')) + filter_ += self.regex + + if self.profile: + for profile in self.profile: + try: + filter_ += self.source_location.get('profiles', + profile + ).split(',') + except ConfigParser.NoSectionError: + LOG.error('No [profiles] section found in {}'.format( + find_config_file('kolla-build.conf'))) + except ConfigParser.NoOptionError: + LOG.error('No profile named "{}" found in {}'.format( + self.profile, + find_config_file('kolla-build.conf'))) + + if filter_: + patterns = re.compile(r"|".join(filter_).join('()')) for image in self.images: if image['status'] == 'matched': continue