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
Modifier and TypeClassDescriptionstatic class
static interface
Mixin interface for anArtifactManager
which supports specialized stash behavior as well.static class
Extension point for customizing behavior of stashes from other plugins. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deprecated.static void
clearAll
(Run<?, ?> build, TaskListener listener) Delete any and all stashes in a build.static void
Deprecated.static void
maybeClearAll
(Run<?, ?> build) Deprecated.static void
maybeClearAll
(Run<?, ?> build, TaskListener listener) Delete any and all stashes in a build unless told otherwise.static void
stash
(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 void
stash
(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes) Deprecated.static void
stash
(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes, boolean useDefaultExcludes) Deprecated.static void
stash
(Run<?, ?> build, String name, FilePath workspace, TaskListener listener, String includes, String excludes, boolean useDefaultExcludes, boolean allowEmpty) Deprecated.static void
unstash
(Run<?, ?> build, String name, FilePath workspace, Launcher launcher, EnvVars env, TaskListener listener) Restores a stash of some files from a build.static void
unstash
(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:
IOException
InterruptedException
-
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:
IOException
InterruptedException
-
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:
IOException
InterruptedException
-
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:
IOException
InterruptedException
- See Also:
-
unstash
@Deprecated public static void unstash(@NonNull Run<?, ?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener) throws IOException, InterruptedExceptionDeprecated.- Throws:
IOException
InterruptedException
-
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 stashIOException
InterruptedException
- 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:
IOException
InterruptedException
- 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:
IOException
InterruptedException
- See Also:
-
copyAll
@Deprecated public static void copyAll(@NonNull Run<?, ?> from, @NonNull Run<?, throws IOException?> to) Deprecated.without replacement; only used fromStashManager.CopyStashesAndArtifacts
anyway- 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.CopyStashesAndArtifacts
anyway