From 53832d82cd0aab5fcdf43fa2f1f014d24377dd51 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 18 Jan 2016 13:30:19 +1100 Subject: [PATCH] Prune old branches in early devstack clone In a rather confusing addendum to Ieb6a6e9f55bd93f63c3d0a71828c276c2d02e1b9, we have actually mirrored a version of the source-repo script from dib and munged it to cache devstack early so we can use it to find the vm images to download and cache. However, we are not ensuring that we remove old branches in this clone, which is leading to the problems of us picking up images from old branches that don't exist any more. Change-Id: I41e81d6bac98875eecde2376e0865784626e11a8 --- .../elements/cache-devstack/extra-data.d/50-early-source-repo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodepool/elements/cache-devstack/extra-data.d/50-early-source-repo b/nodepool/elements/cache-devstack/extra-data.d/50-early-source-repo index f9c574369b..9e0dd8ca92 100755 --- a/nodepool/elements/cache-devstack/extra-data.d/50-early-source-repo +++ b/nodepool/elements/cache-devstack/extra-data.d/50-early-source-repo @@ -128,7 +128,8 @@ function get_repos_for_element(){ HAS_REF=$(git --git-dir=$CACHE_PATH/.git name-rev $REPOREF 2>/dev/null || true) if [ -z "$DIB_OFFLINE" -o -z "$HAS_REF" ] ; then echo "Updating cache of $REPOLOCATION in $CACHE_PATH with ref $REPOREF" - git --git-dir=$CACHE_PATH/.git fetch --update-head-ok $REPOLOCATION +refs/heads/*:refs/heads/* + git --git-dir=$CACHE_PATH/.git fetch --update-head-ok --prune \ + $REPOLOCATION +refs/heads/*:refs/heads/* fi echo "Cloning from $REPONAME cache and applying ref $REPOREF"