summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhurong <aaronzhu1121@gmail.com>2016-07-06 10:00:27 -0400
committerKirill Zaitsev <kzaitsev@mirantis.com>2016-07-08 12:39:01 +0000
commit6eb0a7aab35b7f307fcd89cf9d1c2aa88987aa45 (patch)
tree33cc36f0c4870cacd83a89f008ce41f326169f05
parent369056a1f6021349f91dea1662c0bc36ccb2f155 (diff)
Use upper-constraints in tox test environmentsliberty-eol
This will force pip install to use the upper-constraints.txt specified version of pip modules. When you don't do this, you are out on the bleeding edge and become unstable everytime some python library in the wide world changes in a way that you don't expect. The releasenotes job has no constraints file, so override the install command there. Change-Id: I531606ce2ed981bddc618dac046ab081de2805eb Partial-bug: #1598906
Notes
Notes (review): Code-Review+2: Kirill Zaitsev <kzaitsev@mirantis.com> Verified+1: Murano CI Code-Review+2: Serg Melikyan <smelikyan@mirantis.com> Workflow+1: Serg Melikyan <smelikyan@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 11 Jul 2016 16:14:54 +0000 Reviewed-on: https://review.openstack.org/339535 Project: openstack/python-muranoclient Branch: refs/heads/stable/liberty
-rwxr-xr-xtools/tox_install.sh55
-rw-r--r--tox.ini19
2 files changed, 73 insertions, 1 deletions
diff --git a/tools/tox_install.sh b/tools/tox_install.sh
new file mode 100755
index 0000000..68fa6e2
--- /dev/null
+++ b/tools/tox_install.sh
@@ -0,0 +1,55 @@
1#!/usr/bin/env bash
2
3# Client constraint file contains this client version pin that is in conflict
4# with installing the client from source. We should replace the version pin in
5# the constraints file before applying it for from-source installation.
6
7ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
8BRANCH_NAME=master
9CLIENT_NAME=python-muranoclient
10requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?)
11
12set -e
13
14CONSTRAINTS_FILE=$1
15shift
16
17install_cmd="pip install"
18if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
19
20 mydir=$(mktemp -dt "$CLIENT_NAME-tox_install-XXXXXXX")
21 localfile=$mydir/upper-constraints.txt
22 if [[ $CONSTRAINTS_FILE != http* ]]; then
23 CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
24 fi
25 curl $CONSTRAINTS_FILE -k -o $localfile
26 install_cmd="$install_cmd -c$localfile"
27
28 if [ $requirements_installed -eq 0 ]; then
29 echo "ALREADY INSTALLED" > /tmp/tox_install.txt
30 echo "Requirements already installed; using existing package"
31 elif [ -x "$ZUUL_CLONER" ]; then
32 export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
33 echo "ZUUL CLONER" > /tmp/tox_install.txt
34 pushd $mydir
35 $ZUUL_CLONER --cache-dir \
36 /opt/git \
37 --branch $BRANCH_NAME \
38 git://git.openstack.org \
39 openstack/requirements
40 cd openstack/requirements
41 $install_cmd -e .
42 popd
43 else
44 echo "PIP HARDCODE" > /tmp/tox_install.txt
45 if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then
46 REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements"
47 fi
48 $install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION}
49 fi
50
51 edit-constraints $localfile -- $CLIENT_NAME "-e file://$PWD#egg=$CLIENT_NAME"
52fi
53
54$install_cmd -U $*
55exit $?
diff --git a/tox.ini b/tox.ini
index ab5d24b..1a2e27f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,7 +6,8 @@ skipsdist = True
6[testenv] 6[testenv]
7usedevelop = True 7usedevelop = True
8whitelist_externals = bash 8whitelist_externals = bash
9install_command = pip install -U {opts} {packages} 9install_command =
10 {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
10setenv = VIRTUAL_ENV={envdir} 11setenv = VIRTUAL_ENV={envdir}
11 12
12deps = 13deps =
@@ -18,6 +19,10 @@ commands = bash tools/pretty_tox.sh '{posargs}'
18commands = flake8 {posargs} 19commands = flake8 {posargs}
19 20
20[testenv:venv] 21[testenv:venv]
22# NOTE(from nova tox.ini by jaegerandi): This target does not use constraints
23# because upstream infra does not yet support it. Once that's fixed, we can
24# drop the install_command.
25install_command = pip install -U --force-reinstall {opts} {packages}
21commands = {posargs} 26commands = {posargs}
22 27
23[testenv:functional] 28[testenv:functional]
@@ -26,9 +31,17 @@ setenv =
26passenv = OS_* 31passenv = OS_*
27 32
28[testenv:uitests] 33[testenv:uitests]
34# NOTE(from nova tox.ini by jaegerandi): This target does not use constraints
35# because upstream infra does not yet support it. Once that's fixed, we can
36# drop the install_command.
37install_command = pip install -U --force-reinstall {opts} {packages}
29commands = python setup.py testr --slowest --testr-args="--concurrency 1 {posargs}" 38commands = python setup.py testr --slowest --testr-args="--concurrency 1 {posargs}"
30 39
31[testenv:cover] 40[testenv:cover]
41# NOTE(from nova tox.ini by jaegerandi): This target does not use constraints
42# because upstream infra does not yet support it. Once that's fixed, we can
43# drop the install_command.
44install_command = pip install -U --force-reinstall {opts} {packages}
32commands = python setup.py testr --coverage --testr-args='--concurrency 1 {posargs}' 45commands = python setup.py testr --coverage --testr-args='--concurrency 1 {posargs}'
33 46
34[testenv:pyflakes] 47[testenv:pyflakes]
@@ -36,6 +49,10 @@ deps = flake8
36commands = flake8 49commands = flake8
37 50
38[testenv:releasenotes] 51[testenv:releasenotes]
52# NOTE(from nova tox.ini by jaegerandi): This target does not use constraints
53# because upstream infra does not yet support it. Once that's fixed, we can
54# drop the install_command.
55install_command = pip install -U --force-reinstall {opts} {packages}
39commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html 56commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
40 57
41[flake8] 58[flake8]