Improve BASEIMAGE_ONLY flow

This commit is contained in:
Kristóf Tóth 2018-06-08 11:40:22 +02:00
parent 5ea5f52630
commit 81a930470a
1 changed files with 16 additions and 7 deletions

View File

@ -10,11 +10,14 @@ popd() { command popd "$@" > /dev/null; }
TFWDEV="${TFWDEV:-0}"
HTTPS_REMOTES="${HTTPS_REMOTES:-}"
TFW_POSTFIX=tutorial-framework
BASEDIR="$(pwd)"
BASEIMAGE=baseimage-${TFW_POSTFIX}
TEST=test-${TFW_POSTFIX}
FRONTEND=frontend-${TFW_POSTFIX}
BASEIMAGE_NAME="${BASEIMAGE_NAME:-eu.gcr.io/avatao-challengestore/tutorial-framework}"
LOGFILE=/tmp/bootstrap_tfw.log
remotebase="git@github.com:"
@ -28,10 +31,10 @@ run()
check_dependencies
clone_repos_ask_ssh_or_https
TAG="${BASEIMAGE_ONLY:-$(fetch_latest_tag)}"
TAG=$TAG pin_latest_baseimage
TAG=$TAG build_latest_baseimage
if [ -z "${BASEIMAGE_ONLY:-}" ]; then
TAG=$TAG pin_latest_baseimage
install_frontend_deps
if [ "$TFWDEV" == "0" ]; then
cleanup_repos
@ -41,8 +44,12 @@ run()
delete_repos
fi
echo
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
if [ -z "${BASEIMAGE_ONLY:-}" ]; then
echo
echo "You can build & start TFW by executing the command: ${TEST}/hack/tfw.sh start"
else
echo "Baseimage version ${BASEIMAGE_ONLY} built successfully!"
fi
}
handle_exit()
@ -102,8 +109,10 @@ clone_repos()
echo -n "Cloning TFW repositories... "
echo -n "baseimage... " && logged git clone ${remotebase}avatao-content/${BASEIMAGE}.git
echo -n "frontend... " && logged git clone ${remotebase}avatao-content/${FRONTEND}.git
echo -n "test... " && logged git clone ${remotebase}avatao-content/${TEST}.git
if [ -z "${BASEIMAGE_ONLY:-}" ]; then
echo -n "frontend... " && logged git clone ${remotebase}avatao-content/${FRONTEND}.git
echo -n "test... " && logged git clone ${remotebase}avatao-content/${TEST}.git
fi
echo "Done!"
}
@ -137,9 +146,9 @@ build_latest_baseimage()
{
echo -n "Building baseimage at ${TAG}... "
pushd "$BASEIMAGE"
spinned logged git checkout "$TAG"
logged git checkout "$TAG"
spinned logged docker build -t "${BASEIMAGE_NAME}:${TAG}" .
popd
TFWTAG=$TAG spinned logged ${TEST}/hack/tfw.sh buildtfw
echo "Done!"
}