From 7866cf577eed3dccbae616d709e5ef0252b00e5b Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Thu, 7 Aug 2014 15:53:46 -0700 Subject: [PATCH] better environment messaging, cf_certify_push will send cf to other environments --- bin/cf_certify_push | 54 ++++++++++++++++++++++++++++++++++++++++++--- zsh-files/zshrc | 2 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/bin/cf_certify_push b/bin/cf_certify_push index 9f1a806..9e8856c 100755 --- a/bin/cf_certify_push +++ b/bin/cf_certify_push @@ -6,6 +6,11 @@ set -e main() { PUSHBRANCH=$1 + if [ -z "$STAGE" ]; then + echo "You must specify the \$STAGE variable." + exit 1 + fi + git fetch git checkout "$PUSHBRANCH" git reset --hard "origin/$PUSHBRANCH" @@ -15,10 +20,20 @@ main() { git log --graph --oneline --color origin/master^..HEAD | sed "/$MASTER_SHA/q" separator - echo "*** push this deploy branch into master?" + echo -e "${AQUA}*** push this deploy branch into master? ***${NORMAL}" if yesno; then push-to-master $PUSHBRANCH + DEPLOY_TAG="" + get-deploy-tag $DEPLOY_TAG + echo "Using $DEPLOY_TAG as the deploy tag" + + deploy-to-testopia $DEPLOY_TAG + deploy-to-devc $DEPLOY_TAG + deploy-to-devb $DEPLOY_TAG + cleanup-deploy-branch $PUSHBRANCH + + reminder fi } @@ -42,10 +57,43 @@ push-to-master() { git push origin master } +get-deploy-tag() { + DEPLOY_TAG=$1 + DEPLOY_TAG=`deploy-srv-testopia -l --source="$STAGE" checkout_fulfillment | tail -1` + echo -e "${AQUA}*** Confirm this is the correct deploy-tag ***${NORMAL}" + echo -e "${RED}$DEPLOY_TAG${NORMAL}" + + if yesno; then + return 0 + else + exit 1 + fi +} + +deploy-to-testopia() { + DEPLOY_TAG=$1 + colorize deploy-srv-testopia --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG +} + +deploy-to-devc() { + DEPLOY_TAG=$1 + colorize deploy-srv-devc --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG +} + +deploy-to-devb() { + DEPLOY_TAG=$1 + colorize deploy-srv-devb --no-prompt --source=$STAGE checkout_fulfillment $DEPLOY_TAG +} + cleanup-deploy-branch() { PUSHBRANCH=$1 - colorize git push origin :"$PUSHBRANCH" - colorize git branch -d $PUSHBRANCH + # colorize git push origin :"$PUSHBRANCH" + colorize git branch -D $PUSHBRANCH +} + +reminder() { + figlet "Don't forget..." + echo "run the pushplans on the stage you didn't use!" } main $@ diff --git a/zsh-files/zshrc b/zsh-files/zshrc index df0fae7..38e6dcc 100644 --- a/zsh-files/zshrc +++ b/zsh-files/zshrc @@ -99,5 +99,5 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}☢%{$RESET_COLOR%}" PROMPT=' %{$fg_bold[green]%}[%n@%m] %{$fg[yellow]%}[%~]%{$reset_color%} -%$(in_sandbox){$fg[blue]%}>%{$reset_color%} ' +$(in_sandbox)%{$fg[blue]%}>%{$reset_color%} ' RPROMPT='$(git_prompt_ahead)$(parse_git_dirty) $(branch_prompt)%{$reset_color%} %{$reset_color%}'