From 8f2df0a5b85fb8947999aad27fb98cd1392e1ef0 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 20 Dec 2016 22:30:58 +0100 Subject: allow to override deployment-checks --- deploy.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'deploy.sh') diff --git a/deploy.sh b/deploy.sh index 5f409a8..4a61dac 100755 --- a/deploy.sh +++ b/deploy.sh @@ -10,14 +10,22 @@ if [ $? -ne 0 ]; then exit 1 fi -if [ `git rev-parse --verify origin/master` != `git rev-parse --verify master` ]; then - echo "You have commits on the master branch not pushed to origin yet. They would not be deployed. aborting" - exit 2 +if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then + echo "You have commits on the master branch not pushed to origin yet. They would not be deployed." + echo "do you still which to deploy what's already in the repo? then type yes" + read -p "" input + if [ "x$input" != "xyes" ]; then + exit 2 + fi fi if ! (git diff --exit-code >/dev/null || git diff --cached --exit-code >/dev/null); then - echo "You have uncomitted changes. They would not be deployed. aborting" - exit 2 + echo "You have uncomitted changes. They would not be deployed." + echo "do you still which to deploy what's already in the repo? then type yes" + read -p "" input + if [ "x$input" != "xyes" ]; then + exit 2 + fi fi ssh -A voc@lb.dus.c3voc.de 'sudo sh' << EOT -- cgit v1.2.3 From 86331ff4c0fbac69c9a8df32838c282a0ed2ce12 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 20 Dec 2016 22:37:47 +0100 Subject: shorten available commands check (and require git) --- deploy.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'deploy.sh') diff --git a/deploy.sh b/deploy.sh index 4a61dac..2d32a31 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,8 +1,9 @@ #!/bin/bash -command -v find >/dev/null 2>&1 || { echo >&2 "I require find but it's not installed. Aborting."; exit 1; } -command -v xargs >/dev/null 2>&1 || { echo >&2 "I require xargs but it's not installed. Aborting."; exit 1; } -command -v php >/dev/null 2>&1 || { echo >&2 "I require php but it's not installed. Aborting."; exit 1; } +for cmd in find xargs php git; do + command -v $cmd >/dev/null 2>&1 || { echo >&2 "I require $cmd but it's not installed. Aborting."; exit 1; } +done + find . -name "*.php" -print0 | xargs -0 -n1 php -l if [ $? -ne 0 ]; then -- cgit v1.2.3 From 5ec71310d5ed6e1c4879506de7cae65ef1aab922 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 20 Dec 2016 22:38:02 +0100 Subject: support depoloying a different branch fixes #28 kinda --- deploy.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'deploy.sh') diff --git a/deploy.sh b/deploy.sh index 2d32a31..eec51c5 100755 --- a/deploy.sh +++ b/deploy.sh @@ -11,6 +11,17 @@ if [ $? -ne 0 ]; then exit 1 fi +echo "" +DEPLOY_BRANCH=`git rev-parse --abbrev-ref HEAD` +if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then + echo "You're currently on branch $DEPLOY_BRANCH." + echo "Are you sure you want to deoloy that branch (and not master)? then type yes" + read -p "" input + if [ "x$input" != "xyes" ]; then + exit 2 + fi +fi + if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then echo "You have commits on the master branch not pushed to origin yet. They would not be deployed." echo "do you still which to deploy what's already in the repo? then type yes" @@ -32,7 +43,9 @@ fi ssh -A voc@lb.dus.c3voc.de 'sudo sh' << EOT cd /srv/nginx/streaming-website git fetch origin -git reset --hard origin/master +git reset --hard HEAD +git checkout $DEPLOY_BRANCH +git reset --hard origin/$DEPLOY_BRANCH chown -R voc:staff . chown -R downloader configs ./clear_cache -- cgit v1.2.3