[fix gate] Use upper-constraints on image build

Currently building an image uses requirements but not upper-constraints.
This can cause an issue when libraries change and the image becomes out
of sync with the server code (for example when oslo.context changes).

Trove integration now uses upper-constraints as well when building
images.

Change-Id: Iba5e9976ff9522b7b6fdd523ed78fc6d9b70ea6c
Closes-Bug: #1603506
This commit is contained in:
Peter Stachowski 2016-07-15 17:12:50 +00:00
parent a3e609e192
commit 796d2e8b3d
4 changed files with 38 additions and 2 deletions

View File

@ -17,3 +17,16 @@ REQUIREMENTS_FILE=${REDSTACK_SCRIPTS}/files/requirements/fedora-requirements-${A
[ -n "$HOST_USERNAME" ] || die "HOST_USERNAME not set"
sudo -Hiu ${HOST_USERNAME} dd if=${REQUIREMENTS_FILE} of=${TMP_HOOKS_PATH}/requirements.txt
# Grab the upper constraints file, but don't fail if we can't find it
UC_DIR=$(pwd)
UC_FILE=upper-constraints.txt
UC_BRANCH=${BRANCH_OVERRIDE}
if [ "${ADD_BRANCH}" == "default" ]; then
UC_BRANCH=master
fi
set +e; curl -o "${UC_DIR}/${UC_FILE}" https://git.openstack.org/cgit/openstack/requirements/plain/${UC_FILE}?h=${UC_BRANCH}; set -e
if [ -f "${UC_DIR}/${UC_FILE}" ]; then
sudo -Hiu ${HOST_USERNAME} dd if="${UC_DIR}/${UC_FILE}" of=${TMP_HOOKS_PATH}/${UC_FILE}
rm -f "${UC_DIR}/${UC_FILE}"
fi

View File

@ -18,4 +18,9 @@ dnf install -y python-devel libxml2-devel libxslt-devel python-setuptools \
TMP_HOOKS_DIR="/tmp/in_target.d"
pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt
UPPER_CONSTRAINTS=
if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then
UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
fi
pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}

View File

@ -17,3 +17,16 @@ REQUIREMENTS_FILE=${REDSTACK_SCRIPTS}/files/requirements/ubuntu-requirements-${A
[ -n "$HOST_USERNAME" ] || die "HOST_USERNAME not set"
sudo -Hiu ${HOST_USERNAME} dd if=${REQUIREMENTS_FILE} of=${TMP_HOOKS_PATH}/requirements.txt
# Grab the upper constraints file, but don't fail if we can't find it
UC_DIR=$(pwd)
UC_FILE=upper-constraints.txt
UC_BRANCH=${BRANCH_OVERRIDE}
if [ "${ADD_BRANCH}" == "default" ]; then
UC_BRANCH=master
fi
set +e; curl -o "${UC_DIR}/${UC_FILE}" https://git.openstack.org/cgit/openstack/requirements/plain/${UC_FILE}?h=${UC_BRANCH}; set -e
if [ -f "${UC_DIR}/${UC_FILE}" ]; then
sudo -Hiu ${HOST_USERNAME} dd if="${UC_DIR}/${UC_FILE}" of=${TMP_HOOKS_PATH}/${UC_FILE}
rm -f "${UC_DIR}/${UC_FILE}"
fi

View File

@ -19,4 +19,9 @@ apt-get -y install python-dev libxml2-dev libxslt1-dev python-setuptools \
TMP_HOOKS_DIR="/tmp/in_target.d"
pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt
UPPER_CONSTRAINTS=
if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then
UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
fi
pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}