-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup-github-simulator.sh
executable file
·54 lines (45 loc) · 1.64 KB
/
setup-github-simulator.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
#!/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}##### INTUIT SPRING CLOUD CONFIG VALIDATOR ${VERSION} #####${yellow}"
echo ""
date
echo ""
echo "${green}* Setting up a Github Server simulator"
echo ""
echo "${red}==========--------- Building the new docker image -----------=========="
echo ""
echo "${green}* docker-compose build${yellow}"
echo ""
docker-compose build
echo ""
DOCKER_IMAGE=intuit/intuit-spring-cloud-config-validator:${VERSION}
echo "${red}==========--------- Start a new Github Server simulator -----------=========="
echo ""
echo "${green}* docker run --name gitrepo -e GITHUB_PULL_REQUEST_HEAD=00000000 -e GITHUB_PULL_REQUEST_BASE=f394274 -d -p 52311:22 -e GIT_DIR=/home/git/test.git ${DOCKER_IMAGE}${yellow}"
echo ""
docker stop gitrepo || true
docker rm gitrepo || true
docker run --name gitrepo -e GITHUB_PULL_REQUEST_HEAD=00000000 -e GITHUB_PULL_REQUEST_BASE=f394274 -d -p 52311:22 -e GIT_DIR=/home/git/test.git ${DOCKER_IMAGE}
echo ""
SIMULATOR_SSH_PEM=$(pwd)/.id_rsa_from_github_simulator_server
echo "${red}==========--------- Copying credentials from Github server Container -----------=========="
echo ""
echo "${green}* docker cp gitrepo:/home/git/.ssh/id_rsa ${SIMULATOR_SSH_PEM}${yellow}"
echo ""
docker cp gitrepo:/home/git/.ssh/id_rsa ${SIMULATOR_SSH_PEM}
echo ""
date
echo "${green}"
echo "* Finished setting up the server..."
echo "* Now you can run tests with test.sh copying the command below:"
echo ""
echo "${yellow}GITHUB_SIMULATOR_SSH_PATH=${SIMULATOR_SSH_PEM} ./test.sh"
echo ""