Avoid race condition on .gitconfig.lock 52/23952/1
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 14 Feb 2020 10:30:15 +0000 (11:30 +0100)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 14 Feb 2020 10:30:15 +0000 (11:30 +0100)
on parallel builds on the same host.

This avoids:

error: could not lock config file /home/jenkins/.gitconfig: File exists
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: Ib3f0b3cec91d87f0170c92c6781df67e2e7c75af

jjb/common/include-agl-header.sh

index 2dbf926..6e11883 100644 (file)
@@ -165,6 +165,9 @@ set | grep ^GERRIT || true
 set | grep ^MACHINE || true
 #fi
 
+# to avoid .gitconfig.lock race condition do
+sleep $((1 + RANDOM % 10))
+
 if test ! -f ~/.gitconfig ; then 
   git config --global user.email "jenkins-dontreply@build.automotivelinux.org"
   git config --global user.name "jenkins-dontreply@build.automotivelinux.org"