Only configure jenkins cache if cache exists
Users may not want to build images with a cache as it significantly slows down the build process and results in far larger images. Currently we don't depend on cache-devstack in the jenkins-slave element for this reason. Unfortunately we assume cache-devstack was run because we attempt to link to a directory created by this element. Update jenkins-slave to only make the link if the cache dir exists to address this. Users can now make cacheless images quickly and cheaply. Change-Id: I45ec2fcd614d71f1db85cab3c5c3730a96c8fd61
This commit is contained in:
@@ -15,9 +15,15 @@ useradd -g jenkins -m jenkins -s /bin/bash
|
|||||||
# a lot of caching happens in extra-data.d (for "historical" reasons).
|
# a lot of caching happens in extra-data.d (for "historical" reasons).
|
||||||
# We've put the cache stuff into /opt/cache/files, but again, for
|
# We've put the cache stuff into /opt/cache/files, but again, for
|
||||||
# "historical" reasons, ensure this is available in /home/jenkins
|
# "historical" reasons, ensure this is available in /home/jenkins
|
||||||
|
#
|
||||||
|
# Check if the cache exists as we don't have a strict dependency on the
|
||||||
|
# devstack-cache element. This allows you to build an image without
|
||||||
|
# incurring the cost of caching all the things.
|
||||||
|
if [ -d /opt/cache/files ] ; then
|
||||||
mkdir -p /home/jenkins/cache
|
mkdir -p /home/jenkins/cache
|
||||||
ln -sf /opt/cache/files /home/jenkins/cache/files
|
ln -sf /opt/cache/files /home/jenkins/cache/files
|
||||||
chown -R jenkins:jenkins /opt/cache/files
|
chown -R jenkins:jenkins /opt/cache/files
|
||||||
|
fi
|
||||||
|
|
||||||
# this was copied from outside the chroot by extras.d
|
# this was copied from outside the chroot by extras.d
|
||||||
_pub_key=/tmp/in_target.d/jenkins-user-ssh-public-key
|
_pub_key=/tmp/in_target.d/jenkins-user-ssh-public-key
|
||||||
|
Reference in New Issue
Block a user