Adding options to control DIB repo branch

* Added the -m option
* Added detection of variable DIB_REPO_BRANCH
* Added tag 0.1.17 as default branch of DIB repo
* Added exit error if both DIB_REPO_BRANCH and -m are specified

Implements: blueprint dib-repo-branch-option
Change-Id: I44f0689f7844085c39b5560c65024b68c3424ad8
This commit is contained in:
Michael McCune 2014-05-28 16:13:28 -04:00 committed by Denis Egorenko
parent d18337c542
commit 2762fb4c19
2 changed files with 24 additions and 2 deletions

View File

@ -66,3 +66,9 @@ For developers:
.. sourcecode:: bash
sudo SIM_REPO_PATH="$(pwd)/sahara-image-elements" DIB_REPO_PATH="$(pwd)/diskimage-builder" bash sahara-image-elements/diskimage-create/diskimage-create.sh
3. If you want to specify the diskimage-builder repository branch, or tag, that is used during the diskimage-create script there are two methods. The '-m' option of diskimage-create.sh will always use the 'master' branch of diskimage-builder. Alternatively exporting 'DIB_REPO_BRANCH' will allow the use of an arbitrary branch or tag. By default diskimage-create will use a known good tag from the upstream repository.
.. sourcecode:: bash
sudo DIB_REPO_BRANCH="custom-branch" bash sahara-image-elements/diskimage-create/diskimage-create.sh

View File

@ -9,7 +9,10 @@ unset DIB_IMAGE_SIZE
# default debug setting should be false
IMAGE_GENERATION_DEBUG_MODE="false"
while getopts "p:i:v:d:" opt; do
# The default tag to use for the DIB repo
DEFAULT_DIB_REPO_BRANCH="0.1.17"
while getopts "p:i:v:d:m" opt; do
case $opt in
p)
PLUGIN=$OPTARG
@ -23,10 +26,19 @@ while getopts "p:i:v:d:" opt; do
d)
IMAGE_GENERATION_DEBUG_MODE=$OPTARG
;;
m)
if [ -n "$DIB_REPO_BRANCH" ]; then
echo "Error: DIB_REPO_BRANCH set and -m requested, please choose one."
exit 3
else
DIB_REPO_BRANCH="master"
fi
;;
*)
echo
echo "Usage: $(basename $0) [-p vanilla|spark|hdp|idh] [-i ubuntu|fedora|centos] [-v 1|2|plain] [-d true|false]"
echo "Usage: $(basename $0) [-p vanilla|spark|hdp|idh] [-i ubuntu|fedora|centos] [-v 1|2|plain] [-d true|false] [-m]"
echo "'-p' is plugin version, '-i' is image type, '-v' is hadoop version, '-d controls the debug mode for image generation (false by default)"
echo "'-m' set the diskimage-builder repo to the master branch (default: $DEFAULT_DIB_REPO_BRANCH)"
echo "You shouldn't specify hadoop version and image type for spark plugin"
echo "You shouldn't specify image type for hdp plugin"
echo "Version 'plain' could be specified for hdp plugin only"
@ -37,6 +49,9 @@ while getopts "p:i:v:d:" opt; do
esac
done
if [ -z $DIB_REPO_BRANCH ]; then
DIB_REPO_BRANCH=$DEFAULT_DIB_REPO_BRANCH
fi
# Checks of input
if [ -n "$PLUGIN" -a "$PLUGIN" != "vanilla" -a "$PLUGIN" != "spark" -a "$PLUGIN" != "hdp" -a "$PLUGIN" != "idh" ]; then
@ -107,6 +122,7 @@ export DIB_IMAGE_CACHE=$TEMP/.cache-image-create
if [ -z $DIB_REPO_PATH ]; then
git clone https://git.openstack.org/openstack/diskimage-builder
DIB_REPO_PATH="$(pwd)/diskimage-builder"
git --git-dir=$DIB_REPO_PATH/.git --work-tree=$DIB_REPO_PATH checkout $DIB_REPO_BRANCH
fi
export PATH=$PATH:$DIB_REPO_PATH/bin