project-config/jenkins/scripts/run-tox-api-ref.sh
Tony Breeds b7ea9c81b4 Teach run-tox-api-ref.sh to install requirements with constraints
In trying to add constraints support to os-api-ref we hit a case where
installing os-api-ref with this script will also update requirements.

If a requirement isn't blocked in thw gate *or* os-api-ref hasn't merged the
proposal-bit's update this can lead to failures.

This change addresses that by installing openstack-requirements and
removing os-api-ref from upper-constraints.txt.  Then when it installs
os-api-ref the version from git is appropriate BUT all requirements are
also constrained.

Note: This assumes running in the gate and that the git setup has copied
the upper-constraints.txt into a local file and set the
UPPER_CONSTRAINTS_FILE appropriately.  The new commands will fail and
cause job failures if these pre-conditions are not met.

Change-Id: Ic9b49dbd2b9b8c991fa6d21545460ce015bcc320
Needed-By: I7ad1c2afda29b095ff3d53db5eec7101f8816c2e
2016-12-22 19:39:11 +11:00

34 lines
1.1 KiB
Bash

#!/bin/bash -xe
# If a bundle file is present, call tox with the jenkins version of
# the test environment so it is used. Otherwise, use the normal
# (non-bundle) test environment. Also, run pbr freeze on the
# resulting environment at the end so that we have a record of exactly
# what packages we ended up testing.
#
# Usage: run-tox-api-ref.sh API_REF_DIR
#
# Where VENV is the name of the tox environment to run (specified in the
# project's tox.ini file).
api_ref_dir=${1:-./os-api-ref}
script_path=/usr/local/jenkins/slave_scripts
# NOTE(tonyb): This assumes running in the gate and that the git setup has
# copied the upper-constraints.txt into a local file and set the
# UPPER_CONSTRAINTS_FILE appropriately. The new commands will fail and cause
# job failures if these pre-conditions are not met.
cat <<EOF >> tox.ini
[testenv:api-ref-src]
deps =
{[testenv]deps}
openstack-requirements
commands =
edit-constraints {env:UPPER_CONSTRAINTS_FILE:} -- os-api-ref
pip install -c {env:UPPER_CONSTRAINTS_FILE:} $api_ref_dir
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
EOF
$script_path/run-tox.sh api-ref-src