summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-10-08 17:20:16 +0200
committerFedja Beader <fedja@protonmail.ch>2024-10-08 17:20:58 +0200
commit4640bbf457201ad377ed4c5515a85a13cbd00eee (patch)
tree4212a4ae9f9ce030aca4e31b89d8a71494215605
parent1bf65ed6b8a7ff99cd29d88e69070654f7543896 (diff)
downloadclientdata-specing-fix-ci.tar.gz
clientdata-specing-fix-ci.tar.bz2
clientdata-specing-fix-ci.tar.xz
clientdata-specing-fix-ci.zip
Replace nonexisting $CI_BUILD_REPO with $CI_REPOSITORY_URLspecing-fix-ci
-rwxr-xr-x.tools/init.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/.tools/init.sh b/.tools/init.sh
index d02395d1..7a0d3eb1 100755
--- a/.tools/init.sh
+++ b/.tools/init.sh
@@ -18,11 +18,18 @@ function gitclone1 {
return $?
}
+# First try cloning $2 into $3 from this repository's
+# project space, then use provided fallback space ($1).
function gitclone {
printf '$CI_BUILD_REPO is %s\n' "$CI_BUILD_REPO"
- export name1=$1/$2
- export name2=${CI_BUILD_REPO##*@}
- export name2=https://${name2%/*}/$2
+ printf '$CI_REPOSITORY_URL is %s\n' "$CI_REPOSITORY_URL"
+ printf '$CI_PROJECT_URL is %s\n' "$CI_PROJECT_URL"
+ local name1=$1/$2
+ # Format https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.example.com/my-group/my-project.git
+ # strip token part
+ local name2=${CI_REPOSITORY_URL##*@}
+ # Strip URL down to namespace and append the project we want
+ local name2=https://${name2%/*}/$2
gitclone1 "$name1" "$name2" $3
if [ "$?" != 0 ]; then