summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-10-05 13:11:20 +1300
committerLingxian Kong <anlin.kong@gmail.com>2019-10-11 12:07:48 +1300
commitf8217b99705e43945aa03ca7b559cc8f1ab00102 (patch)
tree122ce5661397dd32cb541a08e0be13925fa02559
parente8a6a60f24abc76b5b040fe3dee916865b9623d4 (diff)
downloadtrove-f8217b99705e43945aa03ca7b559cc8f1ab00102.tar.gz
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 Change-Id: I4d2fe38fac34c75b42234fa7a20aba51e6dc1c4e (cherry picked from commit d244c9d6661a4595533fcbb972798771791f4ed5)
-rw-r--r--devstack/plugin.sh7
-rw-r--r--devstack/settings2
-rw-r--r--doc/source/admin/trovestack.rst3
-rwxr-xr-xintegration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep9
-rw-r--r--integration/scripts/functions_qemu2
-rwxr-xr-xintegration/scripts/trovestack2
-rw-r--r--integration/scripts/trovestack.rc2
7 files changed, 17 insertions, 10 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index e6afa5c2..815ddbf1 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -436,7 +436,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
diff --git a/devstack/settings b/devstack/settings
index 7ad3bb83..cd273918 100644
--- a/devstack/settings
+++ b/devstack/settings
@@ -4,7 +4,7 @@
# Set up default directories
TROVE_DIR=${TROVE_DIR:-${DEST}/trove}
TROVE_REPO=${TROVE_REPO:-${GIT_BASE}/openstack/trove.git}
-TROVE_BRANCH=${TROVE_BRANCH:-master}
+TROVE_BRANCH=${TROVE_BRANCH:-'stable/train'}
TROVE_CLIENT_DIR=${TROVE_CLIENT_DIR:-${TROVECLIENT_DIR:-${DEST}/python-troveclient}}
TROVE_CLIENT_REPO=${TROVE_CLIENT_REPO:-${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git}}
diff --git a/doc/source/admin/trovestack.rst b/doc/source/admin/trovestack.rst
index 7ad33c67..b9f175c8 100644
--- a/doc/source/admin/trovestack.rst
+++ b/doc/source/admin/trovestack.rst
@@ -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:
diff --git a/integration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep b/integration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep
index f563406a..bf71faa7 100755
--- a/integration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep
+++ b/integration/scripts/files/elements/ubuntu-guest/extra-data.d/15-trove-dep
@@ -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
diff --git a/integration/scripts/functions_qemu b/integration/scripts/functions_qemu
index b40adcea..acc62440 100644
--- a/integration/scripts/functions_qemu
+++ b/integration/scripts/functions_qemu
@@ -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
diff --git a/integration/scripts/trovestack b/integration/scripts/trovestack
index 8ad5e341..ecc88f0f 100755
--- a/integration/scripts/trovestack
+++ b/integration/scripts/trovestack
@@ -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
diff --git a/integration/scripts/trovestack.rc b/integration/scripts/trovestack.rc
index eaf74550..0bb12c31 100644
--- a/integration/scripts/trovestack.rc
+++ b/integration/scripts/trovestack.rc
@@ -59,7 +59,7 @@ GIT_OPENSTACK=${GIT_OPENSTACK:-${GIT_BASE}/openstack}
DEVSTACK_REPO=${DEVSTACK_REPO:-${GIT_BASE}/openstack-dev/devstack.git}
TROVE_REPO=${TROVE_REPO:-${GIT_OPENSTACK}/trove.git}
TROVE_DIR=${TROVE_DIR:-${PATH_TROVE}}
-TROVE_BRANCH=${TROVE_BRANCH:-master}
+TROVE_BRANCH=${TROVE_BRANCH:-'stable/train'}
TROVE_CLIENT_REPO=${TROVE_CLIENT_REPO:-${TROVECLIENT_REPO:-${GIT_OPENSTACK}/python-troveclient.git}}
TROVE_CLIENT_DIR=${TROVE_CLIENT_DIR:-${TROVECLIENT_DIR:-${PATH_PYTHON_TROVECLIENT}}}
TROVE_CLIENT_BRANCH=${TROVE_CLIENT_BRANCH:-${TROVECLIENT_BRANCH:-master}}