Class Fingerprinter
- java.lang.Object
-
- hudson.tasks.BuildStepCompatibilityLayer
-
- hudson.tasks.Publisher
-
- hudson.tasks.Recorder
-
- hudson.tasks.Fingerprinter
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Publisher>
,BuildStep
,Serializable
,DependencyDeclarer
,SimpleBuildStep
public class Fingerprinter extends Recorder implements Serializable, DependencyDeclarer, SimpleBuildStep
Records fingerprints of the specified files.- Author:
- Kohsuke Kawaguchi
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Fingerprinter.DescriptorImpl
static class
Fingerprinter.FingerprintAction
Action for displaying fingerprints.-
Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImpl
-
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
enableFingerprintsInDependencyGraph
-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Constructor Summary
Constructors Constructor Description Fingerprinter(String targets)
Fingerprinter(String targets, boolean recordBuildArtifacts)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
buildDependencyGraph(AbstractProject owner, DependencyGraph graph)
Invoked fromAbstractProject.buildDependencyGraph(DependencyGraph)
.boolean
getCaseSensitive()
boolean
getDefaultExcludes()
String
getExcludes()
boolean
getRecordBuildArtifacts()
Deprecated.BuildStepMonitor
getRequiredMonitorService()
Declares the scope of the synchronization monitor thisBuildStep
expects from outside.String
getTargets()
void
perform(Run<?,?> build, FilePath workspace, EnvVars environment, Launcher launcher, TaskListener listener)
Run this step.void
setCaseSensitive(boolean caseSensitive)
void
setDefaultExcludes(boolean defaultExcludes)
void
setExcludes(String excludes)
-
Methods inherited from class hudson.tasks.Recorder
getDescriptor
-
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
-
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, perform, prebuild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, perform, prebuild
-
Methods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
-
-
-
Constructor Detail
-
Fingerprinter
@DataBoundConstructor public Fingerprinter(String targets)
-
Fingerprinter
@Deprecated public Fingerprinter(String targets, boolean recordBuildArtifacts)
Deprecated.
-
-
Method Detail
-
setExcludes
@DataBoundSetter public void setExcludes(String excludes)
-
setDefaultExcludes
@DataBoundSetter public void setDefaultExcludes(boolean defaultExcludes)
-
setCaseSensitive
@DataBoundSetter public void setCaseSensitive(boolean caseSensitive)
-
getTargets
public String getTargets()
-
getExcludes
public String getExcludes()
-
getDefaultExcludes
public boolean getDefaultExcludes()
-
getCaseSensitive
public boolean getCaseSensitive()
-
getRecordBuildArtifacts
@Deprecated public boolean getRecordBuildArtifacts()
Deprecated.
-
perform
public void perform(Run<?,?> build, FilePath workspace, EnvVars environment, Launcher launcher, TaskListener listener) throws InterruptedException
Description copied from interface:SimpleBuildStep
Run this step.This method must be overridden when this step requires a workspace context. If such a context is not required, it does not need to be overridden; it will then forward to
SimpleBuildStep.perform(Run, EnvVars, TaskListener)
.- Specified by:
perform
in interfaceSimpleBuildStep
- Parameters:
build
- a build this is running as a part ofworkspace
- a workspace to use for any file operationsenvironment
- environment variables applicable to this steplauncher
- a way to start processeslistener
- a place to send output- Throws:
InterruptedException
- if the step is interrupted
-
getRequiredMonitorService
public BuildStepMonitor getRequiredMonitorService()
Description copied from interface:BuildStep
Declares the scope of the synchronization monitor thisBuildStep
expects from outside.This method is introduced for preserving compatibility with plugins written for earlier versions of Hudson, which never run multiple builds of the same job in parallel. Such plugins often assume that the outcome of the previous build is completely available, which is no longer true when we do concurrent builds.
To minimize the necessary code change for such plugins,
BuildStep
implementations can request Hudson to externally perform synchronization before executing them. This behavior is as follows:BuildStepMonitor.BUILD
-
This
BuildStep
is only executed after the previous build is fully completed (thus fully restoring the earlier semantics of one build at a time.) BuildStepMonitor.STEP
-
This
BuildStep
is only executed after the same step in the previous build is completed. For build steps that use a weaker assumption and only rely on the output from the same build step of the early builds, this improves the concurrency. BuildStepMonitor.NONE
-
No external synchronization is performed on this build step. This is the most efficient, and thus
the recommended value for newer plugins. Wherever necessary, you can directly use
CheckPoint
s to perform necessary synchronizations.
Migrating Older Implementations: If you are migrating
BuildStep
implementations written for earlier versions of Hudson, here's what you can do:- To demand the backward compatible behavior from Jenkins, leave this method unoverridden, and make no other changes to the code. This will prevent users from reaping the benefits of concurrent builds, but at least your plugin will work correctly, and therefore this is a good easy first step.
-
If your build step doesn't use anything from a previous build (for example, if you don't even call
Run.getPreviousBuild()
), then you can returnBuildStepMonitor.NONE
without making further code changes and you are done with migration. -
If your build step only depends on
Action
s that you added in the previous build by yourself, then you only needBuildStepMonitor.STEP
scope synchronization. Return it from this method ,and you are done with migration without any further code changes. -
If your build step makes more complex assumptions, return
BuildStepMonitor.NONE
and useCheckPoint
s directly in your code. The general idea is to callCheckPoint.block()
before you try to access the state from the previous build.
- Specified by:
getRequiredMonitorService
in interfaceBuildStep
-
buildDependencyGraph
public void buildDependencyGraph(AbstractProject owner, DependencyGraph graph)
Description copied from interface:DependencyDeclarer
Invoked fromAbstractProject.buildDependencyGraph(DependencyGraph)
.- Specified by:
buildDependencyGraph
in interfaceDependencyDeclarer
- Parameters:
owner
- The project that owns the publishers, builders, etc. This information is conceptually redundant, as those objects are only configured against the single owner, but this information is nevertheless passed in since often owner information is not recorded. Never null.graph
- The dependency graph being built. Never null.
-
-