-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathclone-peers.sh
executable file
·36 lines (31 loc) · 1.56 KB
/
clone-peers.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
#!/bin/bash
#################################################################################
# Clone peer repositories
#################################################################################
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/.reporc
GIT_AVAIL=$(which git)
if [ ${?} -ne 0 ]; then
echo "git is not available on your local system. Please install git for your operating system and try again."
exit 1
fi
#Optional overrides to allow for specific default branches to be used.
DEFAULT_BRANCH=${1:-master}
#IBM Cloud Architecture GitHub Repository.
GITHUB_ORG=${CUSTOM_GITHUB_ORG:-ibm-cloud-architecture}
echo "Cloning from GitHub Organization or User Account of \"${GITHUB_ORG}\"."
echo "--> To override this value, run \"export CUSTOM_GITHUB_ORG=your-github-org\" prior to running this script."
echo "Cloning from repository branch \"${DEFAULT_BRANCH}\"."
echo "--> To override this value, pass in the desired branch as a parameter to this script. E.g \"./clone-peers.sh BUILD\""
read -p "Press ENTER to continue"
#Clone all required repositories as a peer of the current directory (root microservices-refapp-netflix repository)
for REPO in ${REQUIRED_REPOS[@]}; do
GIT_REPO="https://github.com/${GITHUB_ORG}/${REPO}.git"
echo -e "\nCloning ${REPO} project"
#The repo refarch-cloudnative-netflix-hystrix-cf does only have master branch
if [[ ${REPO} != "refarch-cloudnative-netflix-hystrix-cf" ]]; then
git clone -b ${DEFAULT_BRANCH} ${GIT_REPO} ../${REPO}
else
git clone -b master ${GIT_REPO} ../${REPO}
fi
done