From ae5e756ddb81fe714a500034a93fa00c5e271828 Mon Sep 17 00:00:00 2001 From: jak1 Date: Sat, 10 Apr 2021 05:29:40 +0000 Subject: added exported var to check if the repository is private, (internal or public is also possible) --- .tools/scripts/init.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.tools/scripts/init.sh b/.tools/scripts/init.sh index bccaaa01..89c044b6 100755 --- a/.tools/scripts/init.sh +++ b/.tools/scripts/init.sh @@ -9,6 +9,15 @@ cat /etc/os-release rm ${ERRFILE} +if [ "$CI_PROJECT_VISIBILITY" == "private" ]; +then + export repo_visible="git@" + echo "using 'git@' to clone repos" +else + export repo_visible="https://" + echo "using 'https://' to clone repos" +fi + function check_error { if [ "$1" != 0 ]; then echo "Error $1" @@ -46,7 +55,7 @@ function gitclone1 { function gitclone { export name1=$1/$2 export name2=${CI_BUILD_REPO##*@} - export name2=https://${name2%/*}/$2 + export name2=${repo_visible}${name2%/*}/$2 gitclone1 "$name1" "$name2" $3 if [ "$?" != 0 ]; then @@ -166,17 +175,17 @@ function do_init_data { function do_init_tools { cd .. rm -rf tools - gitclone https://gitlab.com/themanaworld/evolved evol-tools.git tools + gitclone ${repo_visible}gitlab.com/themanaworld/evolved evol-tools.git tools } function do_init { do_init_data rm -rf server-code - gitclone https://gitlab.com/themanaworld/evolved hercules.git server-code + gitclone ${repo_visible}gitlab.com/themanaworld/evolved hercules.git server-code check_error $? cd server-code/src check_error $? - gitclone https://gitlab.com/themanaworld/evolved evol-hercules.git evol + gitclone ${repo_visible}gitlab.com/themanaworld/evolved evol-hercules.git evol check_error $? cd ../.. check_error $? -- cgit v1.2.3-60-g2f50