Class CoverageRecorder
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Publisher
hudson.tasks.Recorder
io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder
- All Implemented Interfaces:
ExtensionPoint,Describable<Publisher>,BuildStep
A pipeline
Step or Freestyle or Maven Recorder that reads and parses coverage results in a build and
adds the results to the persisted build results.
Stores the created issues in a Node. This result is then attached to the build by registering a
CoverageBuildAction.
- Author:
- Ullrich Hafner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the scope of SCM checks annotations.static classDescriptor for this step: defines the context and the UI elements.Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImplNested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherListNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the actual ID of the results.getId()getName()getScm()io.jenkins.plugins.prism.SourceCodeRetentionSet<io.jenkins.plugins.prism.SourceCodeDirectory> getTools()booleanbooleanbooleanbooleanbooleanbooleanperform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) voidsetChecksAnnotationScope(CoverageRecorder.ChecksAnnotationScope checksAnnotationScope) Sets the scope of the annotations that should be published to SCM checks.voidsetChecksName(String checksName) Changes the default name for the SCM checks report.voidsetEnabledForFailure(boolean enabledForFailure) Returns whether recording should be enabled for failed builds as well.voidsetFailOnError(boolean failOnError) Determines whether to fail the build on errors during the step of recording coverage reports.voidOverrides the default ID of the results.voidsetIgnoreParsingErrors(boolean ignoreParsingErrors) Specify if parsing errors should be ignored and logged instead of throwing an exception.voidOverrides the name of the results.voidsetQualityGates(List<CoverageQualityGate> qualityGates) Defines the optional list of quality gates.voidSets the SCM that should be used to find the reference build for.voidsetSkipPublishingChecks(boolean skipPublishingChecks) Sets whether publishing checks should be skipped or not.voidsetSkipSymbolicLinks(boolean skipSymbolicLinks) Specify if traversal of symbolic links will be skipped during directory scanning for coverage reports.voidsetSourceCodeEncoding(String sourceCodeEncoding) Sets the encoding to use to read source files.voidsetSourceCodeRetention(io.jenkins.plugins.prism.SourceCodeRetention sourceCodeRetention) Defines the retention strategy for source code files.voidsetSourceDirectories(List<io.jenkins.plugins.prism.SourceCodeDirectory> sourceCodeDirectories) Sets the paths to the directories that contain the source code.voidsetTools(List<CoverageTool> tools) Sets the coverage tools that will scan files and create coverage reports.Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, prebuild
-
Constructor Details
-
CoverageRecorder
@DataBoundConstructor public CoverageRecorder()Creates a new instance ofCoverageRecorder.
-
-
Method Details
-
setTools
Sets the coverage tools that will scan files and create coverage reports.- Parameters:
tools- the coverage tools
-
getTools
-
setQualityGates
Defines the optional list of quality gates.- Parameters:
qualityGates- the quality gates
-
getQualityGates
-
setId
Overrides the default ID of the results. The ID is used as URL of the results and as identifier in UI elements. If no ID is given, then the default ID "coverage".- Parameters:
id- the ID of the results- See Also:
-
getId
-
getActualId
Returns the actual ID of the results. If no user-defined ID is given, then the default IDDEFAULT_IDis returned.- Returns:
- the ID
- See Also:
-
setName
Overrides the name of the results. The name is used for all labels in the UI. If no name is given, then the default name is used.- Parameters:
name- the name of the results- See Also:
-
getName
-
setSkipPublishingChecks
@DataBoundSetter public void setSkipPublishingChecks(boolean skipPublishingChecks) Sets whether publishing checks should be skipped or not.- Parameters:
skipPublishingChecks-trueif publishing checks should be skipped,falseotherwise
-
isSkipPublishingChecks
public boolean isSkipPublishingChecks() -
setChecksName
Changes the default name for the SCM checks report.- Parameters:
checksName- the name that should be used for the SCM checks report
-
getChecksName
-
setChecksAnnotationScope
@DataBoundSetter public void setChecksAnnotationScope(CoverageRecorder.ChecksAnnotationScope checksAnnotationScope) Sets the scope of the annotations that should be published to SCM checks.- Parameters:
checksAnnotationScope- the scope to use
-
getChecksAnnotationScope
-
setSkipSymbolicLinks
@DataBoundSetter public void setSkipSymbolicLinks(boolean skipSymbolicLinks) Specify if traversal of symbolic links will be skipped during directory scanning for coverage reports.- Parameters:
skipSymbolicLinks- if symbolic links should be skipped during directory scanning
-
isSkipSymbolicLinks
public boolean isSkipSymbolicLinks() -
setIgnoreParsingErrors
@DataBoundSetter public void setIgnoreParsingErrors(boolean ignoreParsingErrors) Specify if parsing errors should be ignored and logged instead of throwing an exception.- Parameters:
ignoreParsingErrors- if parsing errors should be ignored and logged instead of throwing an exception
-
isIgnoreParsingErrors
public boolean isIgnoreParsingErrors() -
setFailOnError
@DataBoundSetter public void setFailOnError(boolean failOnError) Determines whether to fail the build on errors during the step of recording coverage reports.- Parameters:
failOnError- iftruethen the build will be failed on errors,falsethen errors are only reported in the UI
-
isFailOnError
public boolean isFailOnError() -
setEnabledForFailure
@DataBoundSetter public void setEnabledForFailure(boolean enabledForFailure) Returns whether recording should be enabled for failed builds as well.- Parameters:
enabledForFailure-trueif recording should be enabled for failed builds as well,falseif recording is enabled for successful or unstable builds only
-
isEnabledForFailure
public boolean isEnabledForFailure() -
setSourceCodeEncoding
Sets the encoding to use to read source files.- Parameters:
sourceCodeEncoding- the encoding, e.g. "ISO-8859-1"
-
getSourceCodeEncoding
-
setSourceDirectories
@DataBoundSetter public void setSourceDirectories(List<io.jenkins.plugins.prism.SourceCodeDirectory> sourceCodeDirectories) Sets the paths to the directories that contain the source code. If not relative and thus not part of the workspace, then these directories need to be added in Jenkins global configuration to prevent accessing of forbidden resources.- Parameters:
sourceCodeDirectories- directories containing the source code
-
getSourceDirectories
-
setSourceCodeRetention
@DataBoundSetter public void setSourceCodeRetention(io.jenkins.plugins.prism.SourceCodeRetention sourceCodeRetention) Defines the retention strategy for source code files.- Parameters:
sourceCodeRetention- the retention strategy for source code files
-
getSourceCodeRetention
public io.jenkins.plugins.prism.SourceCodeRetention getSourceCodeRetention() -
setScm
Sets the SCM that should be used to find the reference build for. The reference recorder will select the SCM based on a substring comparison, there is no need to specify the full name.- Parameters:
scm- the ID of the SCM to use (a substring of the full ID)
-
getScm
-
getRequiredMonitorService
-
perform
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException- Specified by:
performin interfaceBuildStep- Overrides:
performin classBuildStepCompatibilityLayer- Throws:
InterruptedExceptionIOException
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Publisher>- Overrides:
getDescriptorin classRecorder
-