use git clone if git archive is unavailable
[build.git] / lbuild-nightly.sh
index af3a49d..d9579bc 100755 (executable)
@@ -689,7 +689,10 @@ function main () {
            GIT_REPO=$(echo $BUILD_SCM_URL | cut -d@ -f1)
            GIT_TAG=$(echo $BUILD_SCM_URL | cut -s -d@ -f2)
            GIT_TAG=${GIT_TAG:-master}
-           mkdir -p $tmpdir; git archive --remote=$GIT_REPO $GIT_TAG | tar -C $tmpdir -xf -
+           mkdir -p $tmpdir 
+            ( git archive --remote=$GIT_REPO $GIT_TAG | tar -C $tmpdir -xf -) || \
+               ( echo "==================== git archive FAILED, trying git clone instead" ; \
+                 git clone $GIT_REPO $tmpdir && cd $tmpdir && git checkout $GIT_TAG && rm -rf .git)
 
             # Create lxc vm
            cd $tmpdir