diff --git a/init.sh b/init.sh index 6c12bca..b06bda0 100755 --- a/init.sh +++ b/init.sh @@ -7,6 +7,29 @@ echo " basic init of wiseadvice node " echo "################################################" +function clone_repo_with_retry(){ + REPO_NAME=$1 + echo "starting to pull into $(pwd)" + git clone git@git.service.wiseadvice.eu:wiseadvice_apps/$REPO_NAME.git -b main + if [ "$?" != "0" ]; then + echo " " + echo -n "Have you checked? Should we try again? type yes: " + read -r yes_no + if [ "$yes_no" = "yes" ]; then + echo "starting to pull into $(pwd)" + git clone git@git.service.wiseadvice.eu:wiseadvice_apps/$REPO_NAME.git -b main + else + echo "Aborting" + exit 1 + fi + fi + + if [ "$?" != "0" ]; then + echo "Aborting" + exit 1 + fi +} + if [ -d "$WA_REPO" ]; then echo "$WA_REPO does exist, skipping cloning" source $WA_REPO/export_client_name.sh @@ -52,17 +75,16 @@ Host git.service.wiseadvice.eu IdentitiesOnly yes EOT - rm -rf $WA_REPO mkdir -p $WA_REPO echo "export CLIENT_NAME=$CLIENT_NAME" > $WA_REPO/export_client_name.sh source $WA_REPO/export_client_name.sh cd $WA_REPO - echo "starting to pull into $(pwd)" - git clone git@git.service.wiseadvice.eu:wiseadvice_apps/shared_resources_k8s.git -b main - git clone git@git.service.wiseadvice.eu:wiseadvice_apps/cimp_$CLIENT_NAME.git -b main - git clone git@git.service.wiseadvice.eu:wiseadvice_apps/common_sysadmin.git -b main + clone_repo_with_retry cimp_$CLIENT_NAME + clone_repo_with_retry shared_resources_k8s + clone_repo_with_retry common_sysadmin + ln -sf $WA_REPO/common_sysadmin/k8s $HOME/kubeconfs_common ln -sf $WA_REPO/shared_resources_k8s/k8s $HOME/kubeconfs_common