Package hudson.plugins.copyartifact
Class BuildSelector
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<BuildSelector>
-
- hudson.plugins.copyartifact.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 Constructor Description BuildSelector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected VirtualFile
getArtifacts(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 FilePath
getSourceDirectory(Run<?,?> src, PrintStream console)
Deprecated.rather overridegetArtifacts(hudson.model.Run<?, ?>, java.io.PrintStream)
protected static boolean
isBuildResultBetterOrEqualTo(Run<?,?> run, Result resultToTest)
Wrapper forResult.isBetterOrEqualTo(Result)
with null checks.protected boolean
isSelectable(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
-
-
-
-
Method Detail
-
getBuild
public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter, Run<?,?> parent)
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 public Run<?,?> getBuild(Job<?,?> job, EnvVars env, BuildFilter filter)
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
protected boolean isSelectable(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.- Parameters:
run
- Build to checkenv
- Environment for build that is copying artifacts- Returns:
- True to select this build
-
isBuildResultBetterOrEqualTo
protected static boolean isBuildResultBetterOrEqualTo(Run<?,?> run, Result resultToTest)
Wrapper forResult.isBetterOrEqualTo(Result)
with null checks. Returnsfalse
ifrun
isnull
orrun
is still running.- Parameters:
run
- Build to test.resultToTest
- Result to test.- Returns:
false
ifrun
isnull
orrun
is still running.- See Also:
Result.isBetterOrEqualTo(Result)
-
getArtifacts
@CheckForNull protected VirtualFile getArtifacts(Run<?,?> sourceBuild, PrintStream console) throws IOException, InterruptedException
Load 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:
IOException
InterruptedException
-
getSourceDirectory
@Deprecated protected FilePath getSourceDirectory(Run<?,?> src, PrintStream console) throws IOException, InterruptedException
Deprecated.rather overridegetArtifacts(hudson.model.Run<?, ?>, java.io.PrintStream)
- Throws:
IOException
InterruptedException
-
-