aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorPaul Bourke <paul.bourke@oracle.com>2015-10-13 15:12:52 +0000
committerPaul Bourke <paul.bourke@oracle.com>2015-10-19 13:31:30 +0100
commit592b3bd066a47e38fa83499757960028c64db092 (patch)
tree9cf12c293b3ef60b851d57dcb5cdc02661c10e42 /kolla
parent42b34bb782c934714ebd05ce8759ccd1407a4703 (diff)
downloadkolla-592b3bd066a47e38fa83499757960028c64db092.tar.gz
kolla-592b3bd066a47e38fa83499757960028c64db092.zip
Add build profiles to build.py
Add ability to define "profiles" in kolla-build.conf, which are predefined sets of images to build at once. The supplied profiles match what Steven defined in the restructure-template bp, though others can easily be added by the user. Multiple profiles can be supplied at once, as well as supplemented by the existing regex mechanism, e.g. to build profiles infra, main, and also ironic, one can use: tools/build.py --profile infra --profile main ironic Change-Id: I0c6f450152cb23dcfc58e0969669fcedf03fab01 Implements: bp restructure-template Doc-Impact
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/cmd/build.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index 55969c9bd..94da59e6f 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