clone.sh: Skip cloning if dependency repo is not defined
If dependency repo URL is not defined in a Jenkins job, it means that
this dependency is not necessary in current job. So skip cloning this
dependency repo in current job to save resources.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Ib6d07b14658b36184e982c64f2b1f7a38cc4e8c7
diff --git a/clone.sh b/clone.sh
index b5b3966..452e6bc 100755
--- a/clone.sh
+++ b/clone.sh
@@ -140,6 +140,11 @@
REPO_NAME="$(echo "${repo}" | awk -F ';' '{print $2}')"
REPO_REFSPEC="$(echo "${repo}" | awk -F ';' '{print $3}')"
+ # In case repository is not defined, just skip it
+ if [ -z "${REPO_URL}" ]; then
+ continue
+ fi
+
if [ ! -d "${SHARE_FOLDER}/${REPO_NAME}" ]; then
git_clone $REPO_URL "${SHARE_FOLDER}/${REPO_NAME}"
git_checkout "${SHARE_FOLDER}/${REPO_NAME}" $REPO_REFSPEC