Stop it with the moving then copying of cache files

Originally, for snapshot images and in early dib days, files were
cached into ~/cache/files (~ being jenkins).  Thus the original
copying of files from ~/cache/files to $DEST/cache/files, introduced
with 25ba5c9bce, was to move these files
from here into the devstack checkouts.

However, when we were converting away from puppet for image builds, we
found that we do this caching very early; before the jenkins user is
created even -- so having the homedir populated was causing issues
creating the user.  Thus we moved the devstack cache to
/opt/cache/files (Ibca6867f29b257a5110cb5522a5cca3a97fa9377)

This copy probably should have been removed at this point.  However,
since we also added back the ~/cache/files symlink this continued to
work.

Thus this removes the unnecessary copy out of ~/cache/files and links
the files into the devstack checkouts directly from /opt/cache/files

Change-Id: I35f76c59d894b00d9544b82a2d8cdcd7f526f243
This commit is contained in:
Monty Taylor 2017-10-11 09:44:01 -05:00 committed by Ian Wienand
parent e473fdec13
commit 1a49f65dd9
1 changed files with 13 additions and 13 deletions

View File

@ -393,7 +393,11 @@ function setup_workspace {
local base_branch=$1
local DEST=$2
local xtrace=$(set +o | grep xtrace)
local cache_dir=$BASE/cache/files/
# Note on infra images, this is setup by
# project-config:nodepool/elements/cache-devstack
# during image builds.
local cache_dir=/opt/cache/files/
# Enabled detailed logging, since output of this function is redirected
set -o xtrace
@ -434,19 +438,15 @@ function setup_workspace {
# It's important we are back at DEST for the rest of the script
cd $DEST
# Populate the cache for devstack (this will typically be vm images)
#
# If it's still in home, move it to /opt, this will make sure we
# have the artifacts in the same filesystem as devstack.
if [ -d ~/cache/files ]; then
sudo mkdir -p $cache_dir
sudo chown -R $USER:$USER $cache_dir
find ~/cache/files/ -mindepth 1 -maxdepth 1 -exec mv {} $cache_dir \;
rm -rf ~/cache/files/
fi
# Copy the cache files to where devstack expects.
# Use hardlinks to save space.
# Protect with if [ -d $cache_dir ] in case there are 3rd parties using
# devstack-gate without cache dirs
if [ -d $cache_dir ]; then
# copy them to where devstack expects with hardlinks to save space
# We're making hardlinks - so we need to be able to write to the files
# in the cache dir.
sudo chown -R $USER:$USER $cache_dir
find $cache_dir -mindepth 1 -maxdepth 1 -exec cp -l {} $DEST/devstack/files/ \;
fi