path: root/apex/builders/
diff options
authorTim Rozet <>2018-10-26 14:03:17 -0400
committerTim Rozet <>2018-11-01 08:46:58 -0400
commitd38e8a91c1a0e3f94d2a19876956ade48d1a8ed2 (patch)
tree9fa6ea0446ad7341e67d1b5ed2c0cf352db219e5 /apex/builders/
parentf20730a6633a9f910a804d5205fbdbff17e622d0 (diff)
Fixes Docker image upload for master/rocky
The API has changed to create/upload the docker container images to be used for deployment. In the past the prepare commands would read the THT environment files passed, to determine which docker images to render into an environment file. The new behavior uses a new "containers-prepare-parameter.yaml" format (included in this patch), which Apex will now configure for deployment. By default docker images will be rendered for all TripleO services identified in the roles_data.yaml file. Therefore we must use several excludes patterns to only pull the docker images needed for a default deployment. JIRA: APEX-642 Change-Id: Iab00fcb874554bb98540dc9a4c3051e58ea68a3b Signed-off-by: Tim Rozet <>
Diffstat (limited to 'apex/builders/')
1 files changed, 39 insertions, 0 deletions
diff --git a/apex/builders/ b/apex/builders/
index b8894ec..e0e7303 100644
--- a/apex/builders/
+++ b/apex/builders/
@@ -14,8 +14,11 @@ import git
import json
import logging
import os
+import platform
+import pprint
import re
import urllib.parse
+import yaml
import as oc_builder
from apex import build_utils
@@ -258,3 +261,39 @@ def create_git_archive(repo_url, repo_name, tmp_dir,
repo.archive(fh, prefix=prefix)
logging.debug("Wrote archive file: {}".format(archive_path))
return archive_path
+def get_neutron_driver(ds_opts):
+ sdn = ds_opts.get('sdn_controller', None)
+ for controllers in 'opendaylight', 'ovn':
+ if sdn == controllers:
+ return sdn
+ if ds_opts.get('vpp', False):
+ return 'vpp'
+ return None
+def prepare_container_images(prep_file, branch='master', neutron_driver=None):
+ if not os.path.isfile(prep_file):
+ raise exc.ApexCommonBuilderException("Prep file does not exist: "
+ "{}".format(prep_file))
+ with open(prep_file) as fh:
+ data = yaml.safe_load(fh)
+ try:
+ p_set = data['parameter_defaults']['ContainerImagePrepare'][0]['set']
+ if neutron_driver:
+ p_set['neutron_driver'] = neutron_driver
+ p_set['namespace'] = "{}".format(branch)
+ if platform.machine() == 'aarch64':
+ p_set['ceph_tag'] = 'master-fafda7d-luminous-centos-7-aarch64'
+ except KeyError:
+ logging.error("Invalid prep file format: {}".format(prep_file))
+ raise exc.ApexCommonBuilderException("Invalid format for prep file")
+ logging.debug("Writing new container prep file:\n{}".format(
+ pprint.pformat(data)))
+ with open(prep_file, 'w') as fh:
+ yaml.safe_dump(data, fh, default_flow_style=False)