summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-08-31 12:58:55 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-31 12:58:55 +0000
commita584057af1d9fd72fd8c186e8364f24c4e7d0cfa (patch)
tree1f3946f19b46d28590e74952bb8a16a041bd1061
parent66cd8949380e677fc7e96d7f18f23e3816a5e961 (diff)
parent91352b165d6cbff77b476ff33bf85094bdfd711c (diff)
Merge "Support build with extent tag"
-rwxr-xr-xci/kolla-build.sh82
1 files changed, 61 insertions, 21 deletions
diff --git a/ci/kolla-build.sh b/ci/kolla-build.sh
index c7ea8884..5784a17e 100755
--- a/ci/kolla-build.sh
+++ b/ci/kolla-build.sh
@@ -9,19 +9,14 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-# Build OpenStack container images as well as extension images.
-# Parameters: $1 kolla git url, for example,
-# https://git.openstack.org/openstack/kolla
-# $2 kolla branch, for example, stable/newton
-# $3 kolla tag, for example, 3.0.2
-
set -o errexit
set -o nounset
set -o pipefail
-KOLLA_GIT=$1
-KOLLA_BRANCH=$2
-KOLLA_TAG=$3
+KOLLA_GIT="https://github.com/huzhijiang/kolla.git"
+KOLLA_BRANCH="stable/ocata"
+KOLLA_TAG=
+EXT_TAG=
KOLLA_GIT_VERSION=
KOLLA_IMAGE_VERSION=
KOLLA_GIT_DIR=/tmp/kolla-git
@@ -29,6 +24,56 @@ REGISTRY_VOLUME_DIR=/tmp/registry
BUILD_OUTPUT_DIR=/tmp/kolla-build-output
REGISTRY_SERVER_NAME=daisy-registry
+function usage
+{
+cat << EOF
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+`basename $0`: Build Daisy4NFV's Kolla image package
+
+usage: `basename $0` [options]
+
+OPTIONS:
+ -l Kolla git repo location
+ -b Kolla git repo branch
+ -t Kolla git repo code tag(base version of image)
+ -e user defined tag extension(extended version)
+
+Examples:
+sudo `basename $0` -l https://git.openstack.org/openstack/kolla
+ -b stable/ocata
+ -t 4.0.2
+ -e 1
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+EOF
+}
+
+while getopts "l:b:t:e:h" OPTION
+do
+ case $OPTION in
+ l)
+ KOLLA_GIT=${OPTARG}
+ ;;
+ b)
+ KOLLA_BRANCH=${OPTARG}
+ ;;
+ t)
+ KOLLA_TAG=${OPTARG}
+ ;;
+ e)
+ EXT_TAG=${OPTARG}
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "${OPTION} is not a valid argument"
+ usage
+ exit 1
+ ;;
+ esac
+done
+
function pre_check {
echo "Pre setup"
if [ $KOLLA_BRANCH == "stable/mitaka" ] ; then
@@ -183,9 +228,14 @@ function update_kolla_code {
popd
}
+function config_kolla {
+ rm -rf /etc/kolla/kolla-build.conf
+ KOLLA_IMAGE_VERSION="${KOLLA_IMAGE_VERSION}.${EXT_TAG}"
+}
+
function start_build {
echo "Start to build Kolla image"
- REGISTRY_PARAM="--registry 127.0.0.1:5000 --push"
+ REGISTRY_PARAM="--registry 127.0.0.1:5000 --push --tag $KOLLA_IMAGE_VERSION"
pushd $KOLLA_GIT_DIR/kolla
# Some of the images may be failed to built out but is OK
@@ -196,17 +246,6 @@ function start_build {
popd
}
-function usage {
- echo "Usage: $0 https://git.openstack.org/openstack/kolla stable/ocata"
-}
-
-if [ "$1" == "" -o "$2" == "" ] ; then
- usage
- exit 1
-fi
-
-
-
exitcode=""
error_trap()
{
@@ -230,6 +269,7 @@ pre_check
# Try to cleanup images of the last failed run, if any.
cleanup_kolla_image
update_kolla_code
+config_kolla
cleanup_kolla_image
# Make sure there is no garbage in the registry server.