From 87730f8f7c02e5d295ccde2925c8b7b14e4ef693 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Tue, 7 Jul 2020 13:05:33 +0200 Subject: [PATCH] create 'add_binary_source_envs' macro and use it There is small subset of images where we need to know which install_type or install_metatype is used. So add them only there (and their children). Change-Id: Ib7d5e36b958d6c8daf2989df32e29fa24b46c62a Implements: blueprint infra-images --- docker/base/Dockerfile.j2 | 2 -- docker/kolla-toolbox/Dockerfile.j2 | 1 + docker/macros.j2 | 5 +++++ docker/monasca/monasca-thresh/Dockerfile.j2 | 1 + docker/openstack-base/Dockerfile.j2 | 1 + docker/ovsdpdk/ovsdpdk/Dockerfile.j2 | 2 +- docker/skydive/skydive-base/Dockerfile.j2 | 2 +- 7 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 55a2e18290..7998471834 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -24,8 +24,6 @@ LABEL kolla_version="{{ kolla_version }}" {% block base_header %}{% endblock %} ENV KOLLA_BASE_DISTRO={{ base_distro }} \ - KOLLA_INSTALL_TYPE={{ install_type }} \ - KOLLA_INSTALL_METATYPE={{ install_metatype }} \ KOLLA_DISTRO_PYTHON_VERSION={{ distro_python_version }} \ KOLLA_BASE_ARCH={{ base_arch }} diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2 index 9f89f3ff8d..36ad4f3fad 100644 --- a/docker/kolla-toolbox/Dockerfile.j2 +++ b/docker/kolla-toolbox/Dockerfile.j2 @@ -10,6 +10,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% import "macros.j2" as macros with context %} +{{ macros.add_binary_source_envs() }} {{ macros.configure_user(name='ansible') }} {{ macros.configure_user(name='rabbitmq') }} diff --git a/docker/macros.j2 b/docker/macros.j2 index 56dd1414a3..7076e422c9 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -80,3 +80,8 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \ {{ handle_repos(repos, 'disable') }} {% endmacro %} + +{% macro add_binary_source_envs() %} +ENV KOLLA_INSTALL_TYPE={{ install_type }} \ + KOLLA_INSTALL_METATYPE={{ install_metatype }} +{% endmacro %} diff --git a/docker/monasca/monasca-thresh/Dockerfile.j2 b/docker/monasca/monasca-thresh/Dockerfile.j2 index 1741cd6a58..2c9200fbad 100644 --- a/docker/monasca/monasca-thresh/Dockerfile.j2 +++ b/docker/monasca/monasca-thresh/Dockerfile.j2 @@ -9,6 +9,7 @@ USER root {% import "macros.j2" as macros with context %} +{{ macros.add_binary_source_envs() }} {{ macros.configure_user(name='monasca') }} {% if install_type == 'binary' %} diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2 index 48d4629ba7..399be32451 100644 --- a/docker/openstack-base/Dockerfile.j2 +++ b/docker/openstack-base/Dockerfile.j2 @@ -7,6 +7,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% import "macros.j2" as macros with context %} +{{ macros.add_binary_source_envs() }} {{ macros.enable_extra_repos(['opstools']) }} {% if install_type == 'binary' %} diff --git a/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 b/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 index 48ba0ccf78..45bb2435ce 100644 --- a/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 +++ b/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 @@ -13,7 +13,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build #TODO(sean-k-mooney) create repo via open suse build system to package # for centos/rhel distros. -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ +RUN echo 'image not yet available for {{ base_distro }}' \ && /bin/false {% elif base_package_type == 'deb' %} diff --git a/docker/skydive/skydive-base/Dockerfile.j2 b/docker/skydive/skydive-base/Dockerfile.j2 index 176a10b900..b2353142e1 100644 --- a/docker/skydive/skydive-base/Dockerfile.j2 +++ b/docker/skydive/skydive-base/Dockerfile.j2 @@ -12,7 +12,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% block skydive_install %} {% if base_arch != 'x86_64' %} -RUN echo '{{ install_type }} on {{ base_distro }} not yet available on non x86_64 platforms' \ +RUN echo 'image on {{ base_distro }} is not yet available on non x86_64 platforms' \ && /bin/false {% else %} RUN curl -o /usr/bin/skydive -L "https://github.com/skydive-project/skydive/releases/download/v0.26.0/skydive" \