Package jenkins.model
Class StandardArtifactManager
- java.lang.Object
-
- jenkins.model.ArtifactManager
-
- jenkins.model.StandardArtifactManager
-
public class StandardArtifactManager extends ArtifactManager
Default artifact manager which transfers files over the remoting channel and stores them inside the build directory. May be subclassed to provide an artifact manager which uses the standard storage but which only overridesarchive(hudson.FilePath, hudson.Launcher, hudson.model.BuildListener, java.util.Map<java.lang.String, java.lang.String>).- Since:
- 1.532
-
-
Field Summary
Fields Modifier and Type Field Description protected Run<?,?>buildstatic FilePath.TarCompressionTAR_COMPRESSION
-
Constructor Summary
Constructors Constructor Description StandardArtifactManager(Run<?,?> build)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidarchive(FilePath workspace, Launcher launcher, BuildListener listener, Map<String,String> artifacts)Archive all configured artifacts from a build.booleandelete()Delete all artifacts associated with an earlier build (if any).voidonLoad(Run<?,?> build)Called when this manager is loaded from disk.VirtualFileroot()Returns a representation of the root directory of archived artifacts.
-
-
-
Field Detail
-
TAR_COMPRESSION
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static FilePath.TarCompression TAR_COMPRESSION
-
build
protected transient Run<?,?> build
-
-
Constructor Detail
-
StandardArtifactManager
public StandardArtifactManager(Run<?,?> build)
-
-
Method Detail
-
onLoad
public final void onLoad(Run<?,?> build)
Description copied from class:ArtifactManagerCalled when this manager is loaded from disk. The selected manager will be persisted inside a build, so the build reference should betransient(quasi-final) and restored here.- Specified by:
onLoadin classArtifactManager- Parameters:
build- a historical build with which this manager was associated
-
archive
public void archive(FilePath workspace, Launcher launcher, BuildListener listener, Map<String,String> artifacts) throws IOException, InterruptedException
Description copied from class:ArtifactManagerArchive all configured artifacts from a build.If called multiple times for the same build, do not delete the old artifacts but keep them all, unless overwritten. For example, the XVNC plugin could use this to save
screenshot.jpgif so configured.This method is typically invoked on a running build, though e.g. in the case of Maven module builds, the build may actually be
Run.State.COMPLETEDwhen this is called (since it is the parent build which is still running and performing archiving).- Specified by:
archivein classArtifactManager- Parameters:
workspace- the root directory from which to copy files (typicallyAbstractBuild.getWorkspace()but not necessarily)launcher- a launcher to use if external processes need to be forkedlistener- a way to print messages about progress or problemsartifacts- map from paths in the archive area to paths relative toworkspace(all paths/-separated)- Throws:
IOException- if transfer or copying failed in any wayInterruptedException- if transfer was interrupted- See Also:
SimpleBuildStep.perform(Run, FilePath, Launcher, TaskListener)
-
delete
public final boolean delete() throws IOException, InterruptedExceptionDescription copied from class:ArtifactManagerDelete all artifacts associated with an earlier build (if any).- Specified by:
deletein classArtifactManager- Returns:
- true if there was actually anything to delete
- Throws:
IOException- if deletion could not be completedInterruptedException- if deletion was interrupted
-
root
public VirtualFile root()
Description copied from class:ArtifactManagerReturns a representation of the root directory of archived artifacts.- Specified by:
rootin classArtifactManager- Returns:
- the archive root
-
-