Lock around source repositories setup

Problems were seen when building images in parallel with
git clones and fetches interfering with each other.

Stop it.

Co-Authored-By: Michael Kerrin <michael.kerrin@hp.com>
Change-Id: Iaa48f259755d8b22327459a5c6d224a342909aee
This commit is contained in:
Jon-Paul Sullivan 2014-06-30 18:34:41 +01:00
parent e93d365114
commit fbb797ea42

View File

@ -188,7 +188,15 @@ rm -f $GIT_MANIFEST
# Get source repositories for the target
for _SOURCEREPO in $(find $TMP_HOOKS_PATH -maxdepth 1 -name "source-repository-*" -not -name '*~'); do
get_repos_for_element $_SOURCEREPO
repo_flock=$CACHE_BASE/repositories_flock
(
echo "Getting $repo_flock: $(date)"
if ! flock -w 600 9 ; then
echo "Did not get $repo_flock: $(date)"
exit 1
fi
get_repos_for_element $_SOURCEREPO
) 9> $repo_flock
done
# Copy the manifest into the image if it exists (there may be no git repositories used)