Use more generic TOX_CONSTRAINTS_FILE

UPPER_CONSTRAINTS_FILE is deprecated[1], we should start using the
new better shiny TOX_CONSTRAINTS_FILE instead.
Also this should fix broken tinyipa jobs after this[2] change merged.

[1] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
[2] https://review.opendev.org/760703

Change-Id: I99762e25133967c31679d2962607b2bf30459af5
This commit is contained in:
Riccardo Pittau 2020-11-04 10:37:11 +01:00
parent adf9a76ecd
commit bceeea1b0a
3 changed files with 12 additions and 12 deletions

View File

@ -119,7 +119,7 @@ if [ -n "$PYTHON_EXTRA_SOURCES_DIR_LIST" ]; then
done done
fi fi
$WORKDIR/generate_upper_constraints.sh upper-constraints.txt $WORKDIR/generate_tox_constraints.sh upper-constraints.txt
if [ -n "$IRONIC_LIB_SOURCE" ]; then if [ -n "$IRONIC_LIB_SOURCE" ]; then
sed -i '/ironic-lib/d' upper-constraints.txt $BUILDDIR/tmp/ipa-requirements.txt sed -i '/ironic-lib/d' upper-constraints.txt $BUILDDIR/tmp/ipa-requirements.txt
fi fi

View File

@ -45,16 +45,16 @@ fail() {
exit 1 exit 1
} }
upper_constraints_is_not_null() { tox_constraints_is_not_null() {
test "${UPPER_CONSTRAINTS_FILE:-""}" != "" test "${TOX_CONSTRAINTS_FILE:-""}" != ""
} }
copy_uc() { copy_uc() {
copy "${UPPER_CONSTRAINTS_FILE:-""}" "${DESTINATION}" copy "${TOX_CONSTRAINTS_FILE:-""}" "${DESTINATION}"
} }
download_uc() { download_uc() {
download "${UPPER_CONSTRAINTS_FILE:-""}" "${DESTINATION}" download "${TOX_CONSTRAINTS_FILE:-""}" "${DESTINATION}"
} }
copy_new_requirements_uc() { copy_new_requirements_uc() {
@ -72,23 +72,23 @@ copy_new_requirements_uc() {
download_from_tox_ini_url() { download_from_tox_ini_url() {
local url local url
# NOTE(mmitchell): This extracts the URL defined as the default value for # NOTE(mmitchell): This extracts the URL defined as the default value for
# UPPER_CONSTRAINTS_FILE in tox.ini. This is used by image # TOX_CONSTRAINTS_FILE in tox.ini. This is used by image
# builders to avoid duplicating the default value in multiple # builders to avoid duplicating the default value in multiple
# scripts. This is specially done to leverage the release # scripts. This is specially done to leverage the release
# tools that automatically update the tox.ini when projects # tools that automatically update the tox.ini when projects
# are released. # are released.
url=$(sed -n 's/^.*{env:UPPER_CONSTRAINTS_FILE\:\([^}]*\)}.*$/\1/p' $TOX_INI | head -n1) url=$(sed -n 's/^.*{env:TOX_CONSTRAINTS_FILE\:\([^}]*\)}.*$/\1/p' $TOX_INI | head -n1)
log "tox.ini indicates '${url}' as fallback." log "tox.ini indicates '${url}' as fallback."
download "${url}" "${DESTINATION}" download "${url}" "${DESTINATION}"
} }
log "Generating local constraints file..." log "Generating local constraints file..."
if upper_constraints_is_not_null; then if tox_constraints_is_not_null; then
log "UPPER_CONSTRAINTS_FILE is defined as '${UPPER_CONSTRAINTS_FILE:-""}'" log "TOX_CONSTRAINTS_FILE is defined as '${TOX_CONSTRAINTS_FILE:-""}'"
copy_uc || download_uc || fail "Failed to copy or download file indicated in UPPER_CONSTRAINTS_FILE." copy_uc || download_uc || fail "Failed to copy or download file indicated in TOX_CONSTRAINTS_FILE."
else else
log "UPPER_CONSTRAINTS_FILE is not defined. Using fallback strategies." log "TOX_CONSTRAINTS_FILE is not defined. Using fallback strategies."
copy_new_requirements_uc || \ copy_new_requirements_uc || \
download_from_tox_ini_url || \ download_from_tox_ini_url || \

View File

@ -11,7 +11,7 @@ setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
[testenv:pep8] [testenv:pep8]