-
Story
-
Resolution: Unresolved
-
Minor
-
None
I am trying to optimize my Jenkins builds by caching the dependencies and restoring them at the start of the build.
Travis has a custom ruby module called casher to handle their cache directives.
I am looking for something similar to avoid having to code it. But the need I have is composed of:
- extract cached data if it exists
if [ -e /cache/${projectid}.tgz ] then tar zxf /cache/${projectid}.tgz fi
- after builds verify if there are any files newer than /cache/${projectid}.tgz and rebuild if needed
rebuild_needed=0
for cached_folder in $cache_folders
do
if find ${cache_folder} -newer /cache/${projectid}.tgz
then
rebuild_needed=1
break
fi
done
if [ $rebuild_needed ]
then
rm /cache/${projectid}.tgz
tar zcf /cache/${projectid}.tgz ${cached_folders}