From 72a8f5aabd31079d6fe8f0442a487689b4ba7bde Mon Sep 17 00:00:00 2001
From: Paul Bourke <paul.bourke@oracle.com>
Date: Mon, 12 Oct 2015 18:09:04 +0000
Subject: [PATCH] Use openstack/requirements for repeatable builds

Add this repo to the openstack-base image, and use the upper-constraints
to install the client packages. Will follow up with dependant patches
for the child images to reduce the risk of breaking everything at once.

--

Background:

Many dependencies in the requirements.txt of OpenStack components have
quite loose version requirements, in many cases they will just specify a
minimum version (e.g. WebOb>=1.2.3).

The result of this is that given a Kolla image for Keystone built today,
another build of the exact same ref of Keystone could be broken
tomorrow, due to it picking up a later unsupported dependency.

The https://github.com/openstack/requirements repo exists to bring some
sanity to this situation. (It also outlines other problems it solves in
it's readme).

We also may like to checkout the stable/liberty branch of this project
in our liberty branch, once it appears.

Change-Id: Iccb4e99f8e4b6659a19c1817d0f4c697824af25c
Partial-Bug: #1505306
---
 docker/openstack-base/Dockerfile.j2 | 6 ++++--
 etc/kolla/kolla-build.conf          | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2
index 345a1b604e..fda017c0c4 100644
--- a/docker/openstack-base/Dockerfile.j2
+++ b/docker/openstack-base/Dockerfile.j2
@@ -73,10 +73,12 @@ RUN apt-get install -y --no-install-recommends \
 
     {% endif %}
 
-RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
+ADD openstack-base-archive /openstack-base-source
+RUN ln -s openstack-base-source/* /requirements \
+    && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
     && python get-pip.py \
     && rm get-pip.py \
-    && pip --no-cache-dir install -U \
+    && pip --no-cache-dir install -U -c requirements/upper-constraints.txt \
         python-barbicanclient \
         python-ceilometerclient \
         python-congressclient \
diff --git a/etc/kolla/kolla-build.conf b/etc/kolla/kolla-build.conf
index c4281248f2..45940fd2ee 100644
--- a/etc/kolla/kolla-build.conf
+++ b/etc/kolla/kolla-build.conf
@@ -56,6 +56,11 @@
 # reference: stable  # git reference to pull, commit sha, tag or branch name
 #                    # pulls from master branch unless specified otherwise
 
+[openstack-base]
+type = git
+location = https://github.com/openstack/requirements.git
+reference = master
+
 [ceilometer-base]
 type = url
 location = http://tarballs.openstack.org/ceilometer/ceilometer-master.tar.gz