Files
trove/integration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep
Lingxian Kong d244c9d666 Support to specify branch when building the image
- Explicity specify branch name for building non-dev image
- Use branch name for building dev image in devstack
- Update the doc

Candidate backport for stable/train

Change-Id: I4d2fe38fac34c75b42234fa7a20aba51e6dc1c4e
2019-10-10 21:55:53 +13:00

44 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
set -o xtrace
# CONTEXT: HOST prior to IMAGE BUILD as SCRIPT USER
# PURPOSE: Setup the requirements file for use by 15-reddwarf-dep
source $_LIB/die
TROVE_BRANCH=${TROVE_BRANCH:-'master'}
REQUIREMENTS_FILE=${TROVESTACK_SCRIPTS}/../../requirements.txt
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"
[ -e ${REQUIREMENTS_FILE} ] || die "Requirements not found"
[ -n "$HOST_USERNAME" ] || die "HOST_USERNAME not set"
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.
# 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
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=${TROVE_BRANCH##stable/}
set +e
curl -L -o "${UC_DIR}/${UC_FILE}" "https://releases.openstack.org/constraints/upper/${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