Class StashManager
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.flow.StashManager
-
public class StashManager extends Object
Manages per-build stashes of files. Unlike artifacts managed byArtifactManager
, 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 Classes Modifier and Type Class Description static class
StashManager.CopyStashesAndArtifacts
static interface
StashManager.StashAwareArtifactManager
Mixin interface for anArtifactManager
which supports specialized stash behavior as well.static class
StashManager.StashBehavior
Extension point for customizing behavior of stashes from other plugins.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
clearAll(Run<?,?> build)
Deprecated.static void
clearAll(Run<?,?> build, TaskListener listener)
Delete any and all stashes in a build.static void
copyAll(Run<?,?> from, Run<?,?> to)
Deprecated.without replacement; only used fromStashManager.CopyStashesAndArtifacts
anywaystatic 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 Map<String,Map<String,String>>
stashesOf(Run<?,?> build)
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 Detail
-
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, InterruptedException
Deprecated.- 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, InterruptedException
Deprecated.- 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, InterruptedException
Deprecated.- 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, InterruptedException
Saves 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:
StashManager.StashAwareArtifactManager.stash(java.lang.String, hudson.FilePath, hudson.Launcher, hudson.EnvVars, hudson.model.TaskListener, java.lang.String, java.lang.String, boolean, boolean)
-
unstash
@Deprecated public static void unstash(@NonNull Run<?,?> build, @NonNull String name, @NonNull FilePath workspace, @NonNull TaskListener listener) throws IOException, InterruptedException
Deprecated.- 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, InterruptedException
Restores 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:
StashManager.StashAwareArtifactManager.unstash(java.lang.String, hudson.FilePath, hudson.Launcher, hudson.EnvVars, hudson.model.TaskListener)
-
clearAll
@Deprecated public static void clearAll(@NonNull Run<?,?> build) throws IOException
Deprecated.- Throws:
IOException
-
clearAll
public static void clearAll(@NonNull Run<?,?> build, @NonNull TaskListener listener) throws IOException, InterruptedException
Delete 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:
StashManager.StashAwareArtifactManager.clearAllStashes(hudson.model.TaskListener)
-
maybeClearAll
@Deprecated public static void maybeClearAll(@NonNull Run<?,?> build) throws IOException
Deprecated.- Throws:
IOException
-
maybeClearAll
public static void maybeClearAll(@NonNull Run<?,?> build, @NonNull TaskListener listener) throws IOException, InterruptedException
Delete 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:
clearAll(Run, TaskListener)
-
copyAll
@Deprecated public static void copyAll(@NonNull Run<?,?> from, @NonNull Run<?,?> to) throws IOException
Deprecated.without replacement; only used fromStashManager.CopyStashesAndArtifacts
anyway- Throws:
IOException
-
stashesOf
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static Map<String,Map<String,String>> stashesOf(@NonNull Run<?,?> build) throws IOException
- Throws:
IOException
-
-