Class StashManager
java.lang.Object
org.jenkinsci.plugins.workflow.flow.StashManager
Manages per-build stashes of files.
Unlike artifacts managed by
ArtifactManager, stashes:
- Are expected to be transferred to other workspaces during the build.
- Generally are discarded when the build finishes.
- Are not exposed as part of the build outside Jenkins, for example via REST.
- Are stored in an archive format with a simple name, not necessarily related to filenames.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceMixin interface for anArtifactManagerwhich supports specialized stash behavior as well.static classExtension point for customizing behavior of stashes from other plugins. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDeprecated.static voidclearAll(Run<?, ?> build, TaskListener listener) Delete any and all stashes in a build.static voidDeprecated.static voidmaybeClearAll(Run<?, ?> build) Deprecated.static voidmaybeClearAll(Run<?, ?> build, TaskListener listener) Delete any and all stashes in a build unless told otherwise.static voidstash(Run<?, ?> build, String name, FilePath workspace, Launcher launcher, EnvVars env, TaskListener listener, String includes, String excludes, boolean useDefaultExcludes, boolean allowEmpty) Saves a stash of some files from a build.static voidstash(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes) Deprecated.static voidstash(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes, boolean useDefaultExcludes) Deprecated.static voidstash(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes, boolean useDefaultExcludes, boolean allowEmpty) Deprecated.static voidunstash(Run<?, ?> build, String name, FilePath workspace, Launcher launcher, EnvVars env, TaskListener listener) Restores a stash of some files from a build.static voidunstash(Run<?, ?> build, String name, FilePath workspace, TaskListener listener) Deprecated.
-
Method Details
-
stash
@Deprecated public static void stash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener, @CheckForNull String includes, @CheckForNull String excludes) throws IOException, InterruptedExceptionDeprecated.- Throws:
IOExceptionInterruptedException
-
stash
@Deprecated public static void stash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener, @CheckForNull String includes, @CheckForNull String excludes, boolean useDefaultExcludes) throws IOException, InterruptedExceptionDeprecated.- Throws:
IOExceptionInterruptedException
-
stash
@Deprecated public static void stash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener, @CheckForNull String includes, @CheckForNull String excludes, boolean useDefaultExcludes, boolean allowEmpty) throws IOException, InterruptedExceptionDeprecated.- Throws:
IOExceptionInterruptedException
-
stash
public static void stash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull EnvVars env, @NonNull TaskListener listener, @CheckForNull String includes, @CheckForNull String excludes, boolean useDefaultExcludes, boolean allowEmpty) throws IOException, InterruptedExceptionSaves a stash of some files from a build.- Parameters:
build- a build to use as storagename- a simple name to assign to the stash (must followJenkins.checkGoodName(java.lang.String)constraints)workspace- a directory to use as a baselauncher- a way to launch processes, if requiredenv- environment to use when launching processes, if requiredlistener- a way to report progress or problemsincludes- a set of Ant-style file includes, separated by commas; null/blank is allowed as a synonym for**(i.e., everything)excludes- an optional set of Ant-style file excludesuseDefaultExcludes- whether to use Ant default excludesallowEmpty- whether to allow an empty stash- Throws:
IOExceptionInterruptedException- See Also:
-
unstash
@Deprecated public static void unstash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener) throws IOException, InterruptedExceptionDeprecated.- Throws:
IOExceptionInterruptedException
-
unstash
public static void unstash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull EnvVars env, @NonNull TaskListener listener) throws IOException, InterruptedExceptionRestores a stash of some files from a build.- Parameters:
build- a build used as storagename- a name passed previously tostash(hudson.model.Run<?, ?>, java.lang.String, hudson.FilePath, hudson.model.TaskListener, java.lang.String, java.lang.String)workspace- a directory to copy intolauncher- a way to launch processes, if requiredenv- environment to use when launching processes, if requiredlistener- a way to report progress or problems- Throws:
AbortException- in case there is no such saved stashIOExceptionInterruptedException- See Also:
-
clearAll
Deprecated.- Throws:
IOException
-
clearAll
public static void clearAll(@NonNull Run<?, ?> build, @NonNull TaskListener listener) throws IOException, InterruptedExceptionDelete any and all stashes in a build.- Parameters:
build- a build possibly passed tostash(hudson.model.Run<?, ?>, java.lang.String, hudson.FilePath, hudson.model.TaskListener, java.lang.String, java.lang.String)in the pastlistener- a way to report progress or problems- Throws:
IOExceptionInterruptedException- See Also:
-
maybeClearAll
Deprecated.- Throws:
IOException
-
maybeClearAll
public static void maybeClearAll(@NonNull Run<?, ?> build, @NonNull TaskListener listener) throws IOException, InterruptedExceptionDelete any and all stashes in a build unless told otherwise.StashManager.StashBehavior.shouldClearAll(hudson.model.Run<?, ?>)may cancel this.- Parameters:
build- a build possibly passed tostash(hudson.model.Run<?, ?>, java.lang.String, hudson.FilePath, hudson.model.TaskListener, java.lang.String, java.lang.String)in the past- Throws:
IOExceptionInterruptedException- See Also:
-
copyAll
@Deprecated public static void copyAll(@NonNull Run<?, ?> from, @NonNull Run<?, throws IOException?> to) Deprecated.without replacement; only used fromStashManager.CopyStashesAndArtifactsanyway- Throws:
IOException
-
stashesOf
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static Map<String,Map<String, stashesOfString>> (@NonNull Run<?, ?> build) throws IOException- Throws:
IOException
-
StashManager.CopyStashesAndArtifactsanyway