Skip to content

Commit cba22d4

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Change Bifrost Python upper-constraints source"
2 parents 0b3945a + 4cab35b commit cba22d4

File tree

5 files changed

+83
-7
lines changed

5 files changed

+83
-7
lines changed

doc/source/admin/image-building.rst

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,69 @@ Python packages build options
373373

374374
The block ``base_pip_conf`` in the ``base`` Dockerfile can be used to provide
375375
the PyPI build customisation options via the standard environment variables
376-
like ``PIP_INDEX_URL``, ``PIP_TRUSTED_HOST``, etc. Also here can be provided
377-
the standard environment variable ``UPPER_CONSTRAINTS_FILE`` used for building
378-
the ``bifrost_deploy`` container when PyPI upper-constraints needs to be
379-
overridden. Also this variable would be used in the ``kolla-toolbox`` if
380-
provided instead of the defaults.
376+
like ``PIP_INDEX_URL``, ``PIP_TRUSTED_HOST``, etc.
377+
378+
To override PYPI upper-constraints of all OpenStack images, you can
379+
define the source location of openstack-base. in ``kolla-build.conf``.
380+
381+
Upstream repository of `openstack-base (requirements) <https://opendev.org/openstack/requirements>`__
382+
has a source of
383+
`upper constraints file <https://opendev.org/openstack/requirements/src/branch/master/upper-constraints.txt>`__.
384+
385+
Make a fork or clone the repository then customise ``upper-constraints.txt``
386+
and define the location of ``openstack-base`` in ``kolla_build.conf``.
387+
388+
.. path /etc/kolla/kolla-build.conf
389+
.. code-block:: ini
390+
391+
# These examples use upstream openstack-base as a demonstration
392+
# To use custom openstack-base, make changes accordingly
393+
394+
# Using git source
395+
[openstack-base]
396+
type = git
397+
location = https://opendev.org/openstack/requirements
398+
reference = master
399+
400+
# Using URL source
401+
[openstack-base]
402+
type = url
403+
location = https://tarballs.opendev.org/openstack/requirements/requirements-master.tar.gz
404+
405+
# Using local source
406+
[openstack-base]
407+
type = local
408+
location = /home/kolla/src/requirements
409+
410+
To remove or change the version of specific Python packages in
411+
``openstack-base`` upper-constraints, you can use the block
412+
``openstack_base_override_upper_constraints`` in your template file,
413+
for example, ``template-overrides.j2``:
414+
415+
.. code-block:: jinja
416+
417+
{% block openstack_base_override_upper_constraints %}
418+
RUN {{ macros.upper_constraints_version_change("sqlparse", "0.4.4", "0.5.0") }}
419+
RUN {{ macros.upper_constraints_remove("reno") }}
420+
{% endblock %}
421+
422+
``kolla-toolbox`` image needs different approach as it does not uses
423+
``openstack-base`` as a base image.
424+
A variable ``UPPER_CONSTRAINTS_FILE`` is set in the
425+
Dockerfile of ``kolla-toolbox``.
426+
To change variable, add the following contents to the
427+
``kolla_toolbox_pip_conf`` block in your template file, for example,
428+
``template-overrides.j2``:
429+
430+
.. code-block:: jinja
431+
432+
{% block kolla_toolbox_pip_conf %}
433+
ENV UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/master
434+
{% endblock %}
435+
436+
.. note::
437+
438+
``UPPER_CONSTRAINTS_FILE`` must be a valid URL to the file
381439

382440
Plugin functionality
383441
--------------------

docker/base/Dockerfile.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ RUN touch /usr/local/bin/kolla_extend_start \
396396
# the variables like PIP_INDEX_URL, PIP_EXTRA_INDEX_URL, PIP_TRUSTED_HOST etc. should be defined here.
397397
# ENV PIP_INDEX_URL=https://pypi.python.org/simple
398398
# ENV PIP_TRUSTED_HOST=pypi.python.org
399-
# ENV UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/{{ openstack_release }}
400399
{% endblock %}
401400

402401
{{ macros.kolla_patch_sources() }}

docker/bifrost/bifrost-base/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ RUN echo " " && \
4545
$VENV/bin/ansible-galaxy collection install -r /bifrost/ansible-collections-requirements.yml && \
4646
$VENV/bin/ansible-playbook -vvvv -i /bifrost/playbooks/inventory/target \
4747
/bifrost/playbooks/install.yaml \
48+
-e upper_constraints_file="/requirements/upper-constraints.txt" \
4849
-e git_branch={{ openstack_branch_slashed }} \
4950
-e ipa_upstream_release={{ openstack_branch }} \
5051
-e enable_inspector=true \

docker/kolla-toolbox/Dockerfile.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,13 @@ RUN cd /usr/bin && \
7878
ln -s python3.12 python3
7979
{% endif %}
8080

81+
{% block kolla_toolbox_pip_conf %}
82+
ENV UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/{{ openstack_release }}
83+
{% endblock %}
84+
8185
{% block kolla_toolbox_upper_constraints %}
8286
RUN mkdir -p /requirements \
83-
&& curl -o /requirements/upper-constraints.txt ${UPPER_CONSTRAINTS_FILE:-https://releases.openstack.org/constraints/upper/{{ openstack_release }}} \
87+
&& curl -o /requirements/upper-constraints.txt $UPPER_CONSTRAINTS_FILE \
8488
&& {{ macros.upper_constraints_remove("openstacksdk") }} \
8589
&& python3 -m venv --system-site-packages {{ venv_path }} \
8690
&& KOLLA_DISTRO_PYTHON_VERSION=$(/usr/bin/python3 -c "import sys; print('{}.{}'.format(sys.version_info.major, sys.version_info.minor))") \
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
features:
3+
- |
4+
Updated the contents of Python package options in documentation to reflect
5+
latest customisation methods.
6+
upgrade:
7+
- |
8+
The use of ``UPPER_CONSTRAINTS_FILE`` environment variable was moved from
9+
``base_pip_conf`` block in base Dockerfile to ``kolla_toolbox_pip_conf``
10+
block in kolla-toolbox Dockerfile as the environment variable now only
11+
affects Kolla-toolbox build.
12+
Bifrost python upper-constraints now follows openstack-base's
13+
python upper-constraints instead of ``UPPER_CONSTRAINTS_FILE`` environment
14+
variable.

0 commit comments

Comments
 (0)