diff options
Diffstat (limited to 'scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep')
-rwxr-xr-x | scripts/files/elements/ubuntu-guest/extra-data.d/15-reddwarf-dep | 36 |
1 files changed, 26 insertions, 10 deletions
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 |