Introduce 'get_pip' macro

We have code for it in four places so it is a good candidate for macro.

Change-Id: Icadcbbe5b386bdf688fd67e8160b40974f047377
This commit is contained in:
Marcin Juszkiewicz 2019-03-08 12:03:15 +01:00
parent fc8b5fa89d
commit ef83ff13fe
6 changed files with 14 additions and 12 deletions

View File

@ -45,9 +45,7 @@ RUN echo 'crane not yet available for {{ base_distro }}' && /bin/false
{% endif %} {% endif %}
{% block crane_source_install_python_pip %} {% block crane_source_install_python_pip %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ {{ macros.get_pip() }}
&& python get-pip.py \
&& rm get-pip.py
{% endblock %} {% endblock %}
ADD crane-archive /crane-source ADD crane-archive /crane-source

View File

@ -35,9 +35,7 @@ ENV helm_version=2.3.0 \
{{ macros.install_packages(helm_repo_packages | customizable("packages")) }} {{ macros.install_packages(helm_repo_packages | customizable("packages")) }}
{% block helm_repository_source_install_python_pip %} {% block helm_repository_source_install_python_pip %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ {{ macros.get_pip() }}
&& python get-pip.py \
&& rm get-pip.py
{% endblock %} {% endblock %}
{% set helm_repository_pip_packages = [ {% set helm_repository_pip_packages = [

View File

@ -47,9 +47,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }} {{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }}
{% block kolla_toolbox_source_install_python_pip %} {% block kolla_toolbox_source_install_python_pip %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ {{ macros.get_pip() }}
&& python get-pip.py \
&& rm get-pip.py
{% endblock %} {% endblock %}
{% set kolla_toolbox_pip_virtualenv_packages = [ {% set kolla_toolbox_pip_virtualenv_packages = [

View File

@ -21,6 +21,12 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro get_pip() %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python get-pip.py \
&& rm get-pip.py
{% endmacro %}
{% macro install_pip(packages, constraints = true, pip_version = pip) %} {% macro install_pip(packages, constraints = true, pip_version = pip) %}
{%- if packages is sequence and packages|length > 0 -%} {%- if packages is sequence and packages|length > 0 -%}
{%- if not pip_version -%} {%- if not pip_version -%}

View File

@ -185,9 +185,7 @@ ENV DEBIAN_FRONTEND noninteractive
{{ macros.install_packages(openstack_base_packages | customizable("packages")) }} {{ macros.install_packages(openstack_base_packages | customizable("packages")) }}
{% block source_install_python_pip %} {% block source_install_python_pip %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ {{ macros.get_pip() }}
&& python get-pip.py \
&& rm get-pip.py
{% endblock %} {% endblock %}
{% set openstack_base_pip_packages = [ {% set openstack_base_pip_packages = [

View File

@ -0,0 +1,4 @@
---
features:
- |
New macro: 'get_pip' allows to bootstrap 'pip' in image.