Package hudson.plugins.copyartifact
Class BuildSelector
- All Implemented Interfaces:
ExtensionPoint,Describable<BuildSelector>
- Direct Known Subclasses:
DownstreamBuildSelector,LastBuildWithArtifactSelector,LastCompletedBuildSelector,ParameterizedBuildSelector,PermalinkBuildSelector,SavedBuildSelector,SpecificBuildSelector,StatusBuildSelector,TriggeredBuildSelector,WorkspaceSelector
public abstract class BuildSelector
extends AbstractDescribableImpl<BuildSelector>
implements ExtensionPoint
Extension point for selecting the build to copy artifacts from.
In a subclass override just isSelectable() for a standard loop through completed
builds, starting with the most recent. Otherwise override getBuild() to provide
different build selection logic.
- Author:
- Alan Harder
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VirtualFilegetArtifacts(Run<?, ?> sourceBuild, PrintStream console) Load artifacts from a given build.Run<?, ?> getBuild(Job<?, ?> job, EnvVars env, BuildFilter filter) Deprecated.Run<?, ?> getBuild(Job<?, ?> job, EnvVars env, BuildFilter filter, Run<?, ?> parent) Find a build to copy artifacts from.protected FilePathgetSourceDirectory(Run<?, ?> src, PrintStream console) Deprecated.protected static booleanisBuildResultBetterOrEqualTo(Run<?, ?> run, Result resultToTest) Wrapper forResult.isBetterOrEqualTo(Result)with null checks.protected booleanisSelectable(Run<?, ?> run, EnvVars env) Should this build be selected? Override just this method to use a standard loop through completed builds, starting with the most recent.Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Constructor Details
-
BuildSelector
public BuildSelector()
-
-
Method Details
-
getBuild
Find a build to copy artifacts from.- Parameters:
job- Source projectenv- Environment for build that is copying artifactsfilter- Additional filter; returned result should return true (return null otherwise)parent- Build to which artifacts are being copied- Returns:
- Build to use, or null if no appropriate build was found
-
getBuild
Deprecated.Find a build to copy artifacts from. Older and deprecated version of API.- Parameters:
job- Source projectenv- Environment for build that is copying artifactsfilter- Additional filter; returned result should return true (return null otherwise)- Returns:
- Build to use, or null if no appropriate build was found
-
isSelectable
Should this build be selected? Override just this method to use a standard loop through completed builds, starting with the most recent.- Parameters:
run- Build to checkenv- Environment for build that is copying artifacts- Returns:
- True to select this build
-
isBuildResultBetterOrEqualTo
Wrapper forResult.isBetterOrEqualTo(Result)with null checks. Returnsfalseifrunisnullorrunis still running.- Parameters:
run- Build to test.resultToTest- Result to test.- Returns:
falseifrunisnullorrunis still running.- See Also:
-
getArtifacts
@CheckForNull protected VirtualFile getArtifacts(Run<?, ?> sourceBuild, PrintStream console) throws IOException, InterruptedExceptionLoad artifacts from a given build.- Parameters:
sourceBuild- a build which may have associated artifactsconsole- a way to print messages- Returns:
- a directory of artifacts, or null if missing
- Throws:
IOExceptionInterruptedException
-
getSourceDirectory
@Deprecated protected FilePath getSourceDirectory(Run<?, ?> src, PrintStream console) throws IOException, InterruptedExceptionDeprecated.rather overridegetArtifacts(hudson.model.Run<?, ?>, java.io.PrintStream)- Throws:
IOExceptionInterruptedException
-
getArtifacts(hudson.model.Run<?, ?>, java.io.PrintStream)