aboutsummaryrefslogtreecommitdiff
path: root/docker/sandbox/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker/sandbox/build.sh')
-rwxr-xr-xdocker/sandbox/build.sh35
1 files changed, 16 insertions, 19 deletions
diff --git a/docker/sandbox/build.sh b/docker/sandbox/build.sh
index 8936fd06..8910f93f 100755
--- a/docker/sandbox/build.sh
+++ b/docker/sandbox/build.sh
@@ -41,7 +41,6 @@ bigtop::hadoop_head_node: ${HEAD_NODE:-"head.node.fqdn"}
hadoop::hadoop_storage_dirs: [/data/1, /data/2]
bigtop::bigtop_repo_uri: ${REPO}
hadoop_cluster_node::cluster_components: [${COMPONENTS}]
-bigtop::jdk_package_name: ${JDK}
EOF
}
@@ -64,18 +63,9 @@ generate_tag() {
fi
}
-detect_jdk() {
- for RPM in ${RPMS[*]}; do
- [[ $OS == $RPM ]] && JDK=$RPM_JDK
- done
- for DEB in ${DEBS[*]}; do
- [[ $OS == $DEB ]] && JDK=$DEB_JDK
- done
-}
-
detect_repo() {
- OS_WITH_CODE_NAME=${OS/ubuntu-14.04/ubuntu-trusty}
- REPO=${REPO:-"http://bigtop-repos.s3.amazonaws.com/releases/${BIGTOP_VERSION}/${OS_WITH_CODE_NAME/-//}/x86_64"}
+ OS_SEP_BY_SLASH=${OS/-//}
+ REPO=${REPO:-"http://bigtop-repos.s3.amazonaws.com/releases/${BIGTOP_VERSION}/${OS_SEP_BY_SLASH}/x86_64"}
}
image_config_validator() {
@@ -103,10 +93,6 @@ deploy_config_validator() {
echo "repository unset!"
invalid=0
fi
- if [ -z "$JDK" ]; then
- echo "jdk unset!"
- invalid=0
- fi
if [ -z "$COMPONENTS" ]; then
echo "components unset!"
invalid=0
@@ -131,16 +117,20 @@ show_deploy_configs() {
echo "DEPLOY CONFIGS:"
echo "REPOSITORY $REPO"
echo "COMPONENTS $COMPONENTS"
- echo "JDK $JDK"
echo "-------------------------------------------------"
}
+log() {
+ echo -e "\n[LOG] $1\n"
+}
+
usage() {
echo "usage: $PROG args"
echo " -a, --account Specify account name for image."
echo " -c, --components Specify components to build."
echo " You need to specify a comma separated, quoted string."
echo " For example: --components \"hadoop, yarn\""
+ echo " -d, --dryrun Generate the Dockerfile and configuration and skip the build."
echo " -f, --file Specify a written site.yaml config file."
echo " -o, --operating-system Specify an OS from Bigtop supported OS list."
echo " RPM base: ${RPMS[*]}"
@@ -158,6 +148,9 @@ while [ $# -gt 0 ]; do
fi
ACCOUNT=$2
shift 2;;
+ -d|--dryrun)
+ DRYRUN=true
+ shift;;
-c|--components)
if [ $# -lt 2 ]; then
usage
@@ -194,7 +187,6 @@ image_config_validator
show_image_configs
if [ -z "$FILE" ]; then
- detect_jdk
detect_repo
deploy_config_validator
generate_config
@@ -203,7 +195,7 @@ else
if [ -f "$FILE" ]; then
cp -vfr $FILE site.yaml.template
else
- echo "$FILE not exist!"
+ log "$FILE not exist!"
exit 1
fi
fi
@@ -211,5 +203,10 @@ fi
export ACCOUNT
export TAG
generate_dockerfile
+if [ "$DRYRUN" == true ]; then
+ log "Generated Dockerfile:"
+ cat Dockerfile
+ exit 0
+fi
build
cleanup