Prune old branches when updating cache

dib builds are failing in nodepool at the moment trying to download a
really old Fedora image.  What happens is that the devstack cache
script [1] goes through all the branches of the devstack checkout and
uses the inbuilt image-list tool [2] to get its list of images to
pre-download.  One of the old Fedora images required on the retired
branches has now gone, so the build halts with a 404 trying to get it.

Thus make sure we do a --prune when we fetch changes so that old
branches are removed from the cache.

[1] https://git.openstack.org/cgit/openstack-infra/project-config/tree/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos
[2] https://git.openstack.org/cgit/openstack-dev/devstack/tree/tools/image_list.sh

Change-Id: Ieb6a6e9f55bd93f63c3d0a71828c276c2d02e1b9
This commit is contained in:
Ian Wienand 2016-01-12 11:25:43 +11:00
parent beae0b21f1
commit 4573d0d930

View File

@ -125,7 +125,7 @@ function get_repos_for_element(){
echo "Updating cache of $REPOLOCATION in $CACHE_PATH with ref $REPOREF" echo "Updating cache of $REPOLOCATION in $CACHE_PATH with ref $REPOREF"
# Copy named refs (which might be outside the usual heads # Copy named refs (which might be outside the usual heads
# pattern) - e.g. gerrit # pattern) - e.g. gerrit
if [ "$REPOREF" == "*" ] || ! git --git-dir=$CACHE_PATH/.git fetch --update-head-ok $REPOLOCATION \ if [ "$REPOREF" == "*" ] || ! git --git-dir=$CACHE_PATH/.git fetch --prune --update-head-ok $REPOLOCATION \
+${REPOREF}:${REPOREF} ; then +${REPOREF}:${REPOREF} ; then
# Copy all heads from the remote repository - this permits # Copy all heads from the remote repository - this permits
# using a SHA1 object reference so long as the object # using a SHA1 object reference so long as the object