-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·55 lines (45 loc) · 1.9 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Colors
green=`tput setaf 2`
red=`tput setaf 1`
yellow=`tput setaf 3`
blue=`tput setaf 4`
reset=`tput sgr0`
CURRENT_SCRIPT=$(basename "$0")
source .env
echo ""
echo "${red}##### GIT REPO SETUP #####${yellow}"
echo ""
date
echo ""
echo "${red}==========--------- Git Repo Local -----------=========="
echo ""
echo "${green}* Current Dir: ${yellow}$(pwd)"
echo ""
ls -la
echo ""
echo "${red}==========--------- Add test Remote -----------=========="
echo ""
echo "${green}* Adding the git origin to current directory with server at ${yellow}$(ipconfig getifaddr en0)"
echo ""
git remote remove test || true
git remote add test git@$(ipconfig getifaddr en0):test.git
echo "${red}==========--------- Git Show test remote -----------=========="
echo ""
echo "${green}* Conectivity with the repo..."
echo "${yellow}GIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}\" git remote show test"
echo ""
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}" git remote show test
echo ""
echo "${red}==========--------- Git push test -----------=========="
echo ""
echo "${green}* Executing 'git push' to test github simulator"
echo "${yellow}GIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}\" git push -u test master"
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}" git push -u test master
echo ""
if [ ! -z "${BRANCH}" ]; then
echo ""
echo "${green}* Testing additional branch ${yellow}${BRANCH}"
echo "GIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}\" git push test ${BRANCH} -f"
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i ${GIT_PEM_PATH}" git push test ${BRANCH} -f
fi