diff options
author | Amrith Kumar <amrith@tesora.com> | 2016-08-08 07:10:04 -0400 |
---|---|---|
committer | Amrith Kumar <amrith@tesora.com> | 2016-08-09 22:06:30 -0400 |
commit | 9e36222ff5c2f2e244584a823099840e06ca0d2a (patch) | |
tree | fe218ee8d356a5d5b5196221c1befa76e20e95da | |
parent | bf6e9296f80811b7f6cf39d01c6d98588969f193 (diff) | |
download | trove-integration-9e36222ff5c2f2e244584a823099840e06ca0d2a.tar.gz |
upper-constraints.txt handling in trove-integration
Currently, trove-integration attempts to get an upper-constraints file
into the guest by looking at the tip of the appropriate branch. This
is fine for developer side testing but not ideal for the CI.
This change looks to see whether the CI setting (DEST) is set, and use
that to see whether $DEST/requirements/upper-constraints.txt is a
file, and if yes to both uses that. If not, it attempts to guess based
on the branch name.
This therefore covers both cases, the CI and the developer environment
and should allow for chaining with jobs that attempt to change u-c.
Co-Authored-By: Tony Breeds <tony@bakeyournoodle.com>
Co-Authored-By: Amrith Kumar <amrith@tesora.com>
Closes-Bug: #1610938
Change-Id: I06406051c849c924371f22b9fe1b03ab99e300f2
4 files changed, 60 insertions, 20 deletions
diff --git a/scripts/files/elements/fedora-guest/extra-data.d/15-reddwarf-dep b/scripts/files/elements/fedora-guest/extra-data.d/15-reddwarf-dep index 95ce5da..97a5e43 100755 --- a/scripts/files/elements/fedora-guest/extra-data.d/15-reddwarf-dep +++ b/scripts/files/elements/fedora-guest/extra-data.d/15-reddwarf-dep @@ -18,15 +18,31 @@ REQUIREMENTS_FILE=${REDSTACK_SCRIPTS}/files/requirements/fedora-requirements-${A 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) +# Grab the upper constraints file, but don't fail if we can't find it. +# If we are running in the CI environment, $DEST will be set and stackrc +# will use $DEST/requirements as the location for the requirements repo. +# Use that as it will help us chain a job with something that is changing UC. + 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}" + +if [ -f "${DEST}/requirements/${UC_FILE}" ]; then + echo "Found ${DEST}/requirements/${UC_FILE}, using that" + sudo -Hiu ${HOST_USERNAME} dd if="${DEST}/requirements/${UC_FILE}" \ + of="${TMP_HOOKS_PATH}/${UC_FILE}" +else + UC_DIR=$(pwd) + 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 fi diff --git a/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep b/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep index 7f3d0dd..98fb24b 100755 --- a/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep +++ b/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep @@ -24,3 +24,7 @@ if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then fi pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS} + +echo "diagnostic pip freeze output follows" +pip freeze +echo "diagnostic pip freeze output above" diff --git a/scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep b/scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep index ee60889..33b4230 100755 --- a/scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep +++ b/scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep @@ -18,15 +18,31 @@ REQUIREMENTS_FILE=${REDSTACK_SCRIPTS}/files/requirements/ubuntu-requirements-${A 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) +# Grab the upper constraints file, but don't fail if we can't find it. +# If we are running in the CI environment, $DEST will be set and stackrc +# will use $DEST/requirements as the location for the requirements repo. +# Use that as it will help us chain a job with something that is changing UC. + 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}" + +if [ -f "${DEST}/requirements/${UC_FILE}" ]; then + echo "Found ${DEST}/requirements/${UC_FILE}, using that" + sudo -Hiu ${HOST_USERNAME} dd if="${DEST}/requirements/${UC_FILE}" \ + of="${TMP_HOOKS_PATH}/${UC_FILE}" +else + UC_DIR=$(pwd) + 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 fi diff --git a/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep b/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep index 0286715..8d989fe 100755 --- a/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep +++ b/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep @@ -25,3 +25,7 @@ if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then fi pip install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS} + +echo "diagnostic pip freeze output follows" +pip freeze +echo "diagnostic pip freeze output above" |