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
This commit is contained in:
Lingxian Kong 2019-10-05 13:11:20 +13:00
parent 650794eaf9
commit d244c9d666
6 changed files with 16 additions and 9 deletions

View File

@ -447,7 +447,12 @@ function create_guest_image {
echo "Starting to create guest image..."
$DEST/trove/integration/scripts/trovestack build-image ${TROVE_DATASTORE_TYPE} ${TROVE_IMAGE_OS} ${TROVE_IMAGE_OS_RELEASE} true
TROVE_BRANCH=${TROVE_BRANCH} $DEST/trove/integration/scripts/trovestack \
build-image \
${TROVE_DATASTORE_TYPE} \
${TROVE_IMAGE_OS} \
${TROVE_IMAGE_OS_RELEASE} \
true
image_name="trove-${TROVE_IMAGE_OS}-${TROVE_IMAGE_OS_RELEASE}-${TROVE_DATASTORE_TYPE}"
image_file=$HOME/images/${image_name}.qcow2

View File

@ -80,6 +80,9 @@ The trove guest agent image could be created by running the following command:
environment, it should be the ``stack`` user.
* ``GUEST_WORKING_DIR``: The place to save the guest image, default value is
``$HOME/images``.
* ``TROVE_BRANCH``: only used in dev mode. The branch name of Trove code
repository, by default it's master, use other branches as needed such as
stable/train.
For example, in order to build a MySQL image for Ubuntu Xenial operating
system in development mode:

View File

@ -1,3 +1,3 @@
# This is used for source-based builds
guest-agent git /opt/guest-agent https://opendev.org/openstack/trove
guest-agent git /opt/guest-agent https://opendev.org/openstack/trove master
upper-constraints file /opt/upper-constraints.txt https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt

View File

@ -8,7 +8,7 @@ set -o xtrace
source $_LIB/die
BRANCH_OVERRIDE=${BRANCH_OVERRIDE:-default}
TROVE_BRANCH=${TROVE_BRANCH:-'master'}
REQUIREMENTS_FILE=${TROVESTACK_SCRIPTS}/../../requirements.txt
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"
@ -30,13 +30,10 @@ if [ -f "${DEST}/requirements/${UC_FILE}" ]; then
of="${TMP_HOOKS_PATH}/${UC_FILE}"
else
UC_DIR=$(pwd)
UC_BRANCH=${BRANCH_OVERRIDE}
if [ "${UC_BRANCH}" == "default" ]; then
UC_BRANCH=master
fi
UC_BRANCH=${TROVE_BRANCH##stable/}
set +e
curl -o "${UC_DIR}/${UC_FILE}" "https://opendev.org/openstack/requirements/raw/branch/${UC_BRANCH}/${UC_FILE}"
curl -L -o "${UC_DIR}/${UC_FILE}" "https://releases.openstack.org/constraints/upper/${UC_BRANCH}"
set -e
if [ -f "${UC_DIR}/${UC_FILE}" ]; then

View File

@ -36,6 +36,8 @@ function build_vm() {
export HOST_SCP_USERNAME=${HOST_SCP_USERNAME:-$(whoami)}
export HOST_USERNAME=${HOST_SCP_USERNAME}
export SSH_DIR=${SSH_DIR:-"$HOME/.ssh"}
export DEST=${DEST:-'/opt/stack'}
export TROVE_BRANCH=${TROVE_BRANCH:-'master'}
manage_ssh_keys
fi

View File

@ -827,7 +827,7 @@ function cmd_build_image() {
local IMAGE_GUEST_OS=${2:-'ubuntu'}
local IMAGE_GUEST_RELEASE=${3:-'xenial'}
local DEV_MODE=${4:-'true'}
local guest_username=${5:-"ubuntu"}
local guest_username=${5:-'ubuntu'}
local output=$6
if [[ -z "$output" ]]; then