Class ArbitraryFileCache

  • All Implemented Interfaces:
    ExtensionPoint, Describable<Cache>, Serializable

    public class ArbitraryFileCache
    extends Cache
    This class implements a Cache where the user can configure a path on the executor that will be cached. Users can reference environment variables on the executor in the path and supply an includes and excludes pattern to limit the files that are cached.
    Author:
    Peter Hayes
    See Also:
    Serialized Form
    • Constructor Detail

      • ArbitraryFileCache

        @DataBoundConstructor
        public ArbitraryFileCache​(String path,
                                  String includes,
                                  String excludes)
    • Method Detail

      • setUseDefaultExcludes

        @DataBoundSetter
        public void setUseDefaultExcludes​(boolean useDefaultExcludes)
      • getUseDefaultExcludes

        public boolean getUseDefaultExcludes()
      • setCacheValidityDecidingFile

        @DataBoundSetter
        public void setCacheValidityDecidingFile​(String cacheValidityDecidingFile)
      • getCacheValidityDecidingFile

        public String getCacheValidityDecidingFile()
      • setPath

        public void setPath​(String path)
      • getPath

        public String getPath()
      • setIncludes

        public void setIncludes​(String includes)
      • getIncludes

        public String getIncludes()
      • setExcludes

        public void setExcludes​(String excludes)
      • getExcludes

        public String getExcludes()
      • getCacheName

        public String getCacheName()
      • setCacheName

        @DataBoundSetter
        public void setCacheName​(String cacheName)
      • createCacheBaseName

        public String createCacheBaseName()
      • getTitle

        public String getTitle()
        Description copied from class: Cache
        Gets the human-readable title for this cache to be shown on the user interface.
        Specified by:
        getTitle in class Cache
        Returns:
        The title of the cache
      • cache

        public Cache.Saver cache​(ObjectPath cachesRoot,
                                 ObjectPath fallbackCachesRoot,
                                 Run<?,​?> build,
                                 FilePath workspace,
                                 Launcher launcher,
                                 TaskListener listener,
                                 EnvVars initialEnvironment,
                                 boolean skipRestore)
                          throws IOException,
                                 InterruptedException
        Description copied from class: Cache
        Seeds the cache on the executor from the cache storage system.
        Specified by:
        cache in class Cache
        Parameters:
        cachesRoot - The root of the object cache
        fallbackCachesRoot - The root of the alternate default object cache
        build - The build in progress
        workspace - The executor workspace
        launcher - The launcher
        listener - The task listener
        initialEnvironment - The initial environment variables
        skipRestore - Whether to skip restoring the cache
        Throws:
        IOException - If an error occurs connecting to the potentially remote executor
        InterruptedException - If interrupted
      • doDynamic

        public org.kohsuke.stapler.HttpResponse doDynamic​(org.kohsuke.stapler.StaplerRequest req,
                                                          org.kohsuke.stapler.StaplerResponse rsp,
                                                          @AncestorInPath
                                                          Job<?,​?> job)
                                                   throws IOException,
                                                          javax.servlet.ServletException,
                                                          InterruptedException
        Throws:
        IOException
        javax.servlet.ServletException
        InterruptedException