@@ -688,9 +688,6 @@ function dvcs_commit_all {
688688 fi
689689}
690690
691- # This code was auto generated by with these options:
692- # - file:///Users/aray/bash-prompt-builder/index.html#git=true&git-prefix=false&git-ahead=true&git-modified=true&git-conflicted=true&git-revno=false&git-bisect=true&hg=true&hg-prefix=false&hg-modified=true&hg-conflicted=true&hg-revno=false&hg-bisect=true&hg-patches=true&svn=true&svn-modified=true&svn-revno=true&comments=false&modified-char=%E2%9C%8E&conflict-char=%E2%98%A2&max-conflicted-files=2&no-branch-text=no%20branch!&bisecting-text=%CF%9F
693- #
694691# Requirements (other than git, svn and hg):
695692# hg-prompt: https://bitbucket.org/sjl/hg-prompt/src
696693# svnversion (you probably have it if you have svn)
@@ -903,7 +900,6 @@ dvcs_function="
903900 fi
904901
905902 echo -e \$ prompt"
906- # End code auto generated by http://andrewray.me/bash-prompt-builder/index.html
907903
908904function error_test() {
909905 if [[ $? = " 0" ]]; then
@@ -930,7 +926,7 @@ function ding() {
930926}
931927
932928# Python development, requires pyenv from homebrew
933- # Needs to go before GR stuff to
929+ # Needs to go before GR stuff
934930if [[ $( command -v pyenv) ]]; then
935931 export PYENV_ROOT=" $HOME /.pyenv"
936932
@@ -955,27 +951,8 @@ function gr_locked_gpg() {
955951 fi
956952}
957953
958- sleep_rand () {
959- rand=${RANDOM: 0: 1} # 0 - 9 https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash
960- sleep " 0.${rand} "
961- }
962954
963955if [ -d " $GR_HOME " ]; then
964-
965- sleep_rand
966- locked=$( gr_locked_gpg)
967- if [ " $locked " == " 1" ]; then
968- echo ' Someone else is using the gpg agent, waitng...'
969- bail=0
970-
971- while [ " $locked " == " 1" ] && [ $bail != 100 ]
972- do
973- sleep_rand
974- locked=$( gr_locked_gpg)
975- let bail+=1
976- done
977- fi
978-
979956 for file in ${GR_HOME} /engineering/bash/* .sh; do
980957 source " $file "
981958 done
@@ -1056,117 +1033,9 @@ function releaseCommits() {
10561033 echo " https://github.com/ConsultingMD/jarvis/compare/${lastReleaseBranchWithoutRemote} ...${currentReleaseBranchWithoutRemote} "
10571034}
10581035
1059- # function pvault() {
1060- # production && \
1061- # echo '🌐 Opening SSH tunnel named "my-vault-tunnel" in background...' && \
1062- # HOST=$(ec2-find -l stone-worker 2> /dev/null | tail -1 | awk '{print $1}') && \
1063- # ssh -M -S my-vault-tunnel -fnNT -L "1234:vault.grandrounds.com:443" "$GR_USERNAME@$HOST" && \
1064- # ssh -S my-vault-tunnel -O check "$GR_USERNAME@$HOST" && \
1065- # sleep 5 && \
1066- # echo '🔐 Use this token to log in:' && \
1067- # (aws-environment infra-production developer && \
1068- # VAULT_ADDR=https://localhost:1234 vault login -tls-skip-verify -token-only -method=aws role=developer) && \
1069- # open 'https://localhost:1234/ui/vault/auth?with=token' && \
1070- # echo '✅ Run kvault this command to close the tunnel'
1071- # }
1072-
1073- function vault-tunnel() {
1074- if [[ -z " $1 " ]]; then
1075- echo ' Usage: vault_tunnel ENVIRONMENT_NAME'
1076- return 1
1077- fi
1078-
1079- # Check for an existing tunnel (this may be mac specific?)
1080- local already_bound
1081- already_bound=$( lsof -n -i4TCP:1234 | grep LISTEN)
1082- if [[ -n " $already_bound " ]]; then
1083- local pid
1084- pid=$( echo " $already_bound " | awk ' {print $2}' )
1085- echo ' ❌ There is already something bound to port 1234! Here it is:'
1086- echo " $already_bound "
1087- echo ' 💀 You can try running kvault, or manually kill the process by running:'
1088- echo " kill ${pid} "
1089- return 1
1090- fi
1091-
1092- # Create the bind port and host, note production has snowflake hostname
1093- local tunnel_bind=" 1234:vault.${1} .grandrounds.com:443"
1094- if [[ " $1 " == " production" ]]; then
1095- tunnel_bind=" 1234:vault.grandrounds.com:443"
1096- fi
1097- local tunnel_host=" $GR_USERNAME @$HOST "
1098-
1099- echo ' 🌐 Opening SSH tunnel named "my-vault-tunnel" in background...'
1100-
1101- # Chain all functions with && \ so that if one errors the rest don't execute
1102- aws-environment " $1 " && \
1103- HOST=$( ec2-find -l stone-worker 2> /dev/null | tail -1 | awk ' {print $1}' ) && \
1104- ssh -M -S my-vault-tunnel -fnNT -L " $tunnel_bind " " $tunnel_host " && \
1105- ssh -S my-vault-tunnel -O check " $tunnel_host " && \
1106- # Trying to run vault commands too quickly after tunnel starts fail
1107- sleep 5 && \
1108- echo ' ✅ Tunnel running. Run kill_vault_tunnel close the tunnel'
1109- }
1110-
1111- function vault-login() {
1112- if [[ -z " $1 " ]]; then
1113- echo ' Usage: vault_login ENVIRONMENT_NAME'
1114- return 1
1115- fi
1116-
1117- local account
1118- case $1 in
1119- integration3) account=' platform-dev' ;;
1120- uat) account=' infra-uat' ;;
1121- production) account=' infra-production' ;;
1122- * ) echo " I don't know how to log in to Vault for environment '$1 '" ;;
1123- esac
1124-
1125- vault_tunnel " $1 " && \
1126- echo -e ' 🔐 Use this token to log in:\n' && \
1127- (aws-environment ${account} developer && \
1128- VAULT_ADDR=https://localhost:1234 vault login -tls-skip-verify -token-only -method=aws role=developer) && \
1129- echo -e ' \n💻 Opening a browser to https://localhost:1234/ui/vault/auth?with=token ...' && \
1130- echo ' You may need to sign out and re-authenticate with your new token' && \
1131- open ' https://localhost:1234/ui/vault/auth?with=token'
1132- }
1133-
1134- # function i3vault() {
1135- # aws-environment integration3 && \
1136- # echo '🌐 Opening SSH tunnel named "my-vault-tunnel" in background...' && \
1137- # HOST=$(ec2-find -l stone-worker 2> /dev/null | tail -1 | awk '{print $1}') && \
1138- # ssh -M -S my-vault-tunnel -fnNT -L "1234:vault.$(aws-environment).grandrounds.com:443" "$GR_USERNAME@$HOST" && \
1139- # ssh -S my-vault-tunnel -O check "$GR_USERNAME@$HOST" && \
1140- # sleep 5 && \
1141- # echo '🔐 Use this token to log in:' && \
1142- # (aws-environment platform-dev developer && \
1143- # VAULT_ADDR=https://localhost:1234 vault login -tls-skip-verify -token-only -method=aws role=developer) && \
1144- # open 'https://localhost:1234/ui/vault/auth?with=token' && \
1145- # echo '✅ Run kvault this command to close the tunnel'
1146- # }
1147-
1148- # function uvault() {
1149- # uat && \
1150- # echo '🌐 Opening SSH tunnel named "my-vault-tunnel" in background...' && \
1151- # HOST=$(ec2-find -l stone-worker 2> /dev/null | tail -1 | awk '{print $1}') && \
1152- # ssh -M -S my-vault-tunnel -fnNT -L "1234:vault.$(aws-environment).grandrounds.com:443" "$GR_USERNAME@$HOST" && \
1153- # ssh -S my-vault-tunnel -O check "$GR_USERNAME@$HOST" && \
1154- # sleep 5 && \
1155- # echo '🔐 Use this token to log in:' && \
1156- # (aws-environment infra-uat developer && \
1157- # VAULT_ADDR=https://localhost:1234 vault login -tls-skip-verify -token-only -method=aws role=developer) && \
1158- # open 'https://localhost:1234/ui/vault/auth?with=token' && \
1159- # echo '✅ Run kvault this command to close the tunnel'
1160- # }
1161-
1162- function kvault() {
1163- echo " 💀 Killing my-vault-tunnel tunnel at $GR_USERNAME @$HOST "
1164- ssh -S my-vault-tunnel -O exit " $GR_USERNAME @$HOST "
1165- }
1166-
11671036function jgrep() {
11681037 # bundle exec rake routes > ~/dev/rake-routes
1169- cat ~ /dev/rake-routes | grep " $1 "
1038+ cat ~ /dev/rake-routes | grep -i " $1 "
11701039}
11711040
11721041if type " bat" > /dev/null 2>&1 ; then
0 commit comments