Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50261

Support caching of specific folders between builds

XMLWordPrintable

      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:

      1. extract cached data if it exists

      if [ -e /cache/${projectid}.tgz ] then tar zxf /cache/${projectid}.tgz fi

      1. 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}

            Unassigned Unassigned
            trajano Archimedes Trajano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: