Class IssuesRecorder
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Publisher
hudson.tasks.Recorder
io.jenkins.plugins.analysis.core.steps.IssuesRecorder
- All Implemented Interfaces:
ExtensionPoint,Describable<Publisher>,BuildStep
Freestyle or Maven job
Recorder that scans report files or the console log for issues. Stores the created
issues in an AnalysisResult. The result is attached to a Run by registering a ResultAction.
Additional features:
- It evaluates the quality gates after each run. If the quality gate is not passed,
then the build will be set to
Result.UNSTABLEorResult.FAILURE, depending on the configuration properties. - It provides thresholds for the build health that could be adjusted in the configuration screen.
These values are used by the
HealthReportBuilderto compute the health and the health trend graph.
- Author:
- Ullrich Hafner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic 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 TypeMethodDescriptionbooleanReturns whether the results for each configured static analysis result should be aggregated into a single result or if every tool should get an individual result.booleanReturns whether the SCM blaming should be disabled.io.jenkins.plugins.analysis.core.steps.WarningChecksPublisher.ChecksAnnotationScopebooleanReturns whether recording should be enabled for failed builds as well.booleanintgetIcon()getId()booleangetName()getScm()io.jenkins.plugins.prism.SourceCodeRetentionList<io.jenkins.plugins.prism.SourceCodeDirectory>Deprecated.this method is only intended to be called by the UIgetTools()Returns the static analysis tools that will scan files and create issues.intbooleanisQuiet()Returns whether report logging should be enabled.booleanReturns whether the SCM blaming should be disabled.booleanReturns whether the SCM delta calculation for the new issue detection should be disabled.booleanReturns whether post-processing of the issues should be disabled.booleanReturns whether publishing checks should be skipped.booleanperform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) protected ObjectCalled after deserialization to retain backward compatibility or to populate new elements (that would be otherwise initialized tonull).voidsetAggregatingResults(boolean aggregatingResults) voidsetBlameDisabled(boolean blameDisabled) voidsetChecksAnnotationScope(io.jenkins.plugins.analysis.core.steps.WarningChecksPublisher.ChecksAnnotationScope checksAnnotationScope) Sets the scope of the annotations that should be published to SCM checks.voidsetChecksInfo(io.jenkins.plugins.checks.steps.ChecksInfo checksInfo) voidsetEnabledForFailure(boolean enabledForFailure) voidsetFailOnError(boolean failOnError) Determines whether to fail the step on errors during the step of recording issues.voidsetFilters(List<RegexpFilter> filters) voidsetHealthy(int healthy) Sets the healthy threshold, i.e.voidDefines the custom icon of the results.voidDefines the ID of the results.voidsetIgnoreQualityGate(boolean ignoreQualityGate) Iftrue, then the result of the quality gate is ignored when selecting a reference build.voidsetMinimumSeverity(String minimumSeverity) Sets the minimum severity to consider when computing the health report.voidDefines the name of the results.voidsetQualityGates(List<WarningsQualityGate> qualityGates) Defines the optional list of quality gates.voidsetQuiet(boolean quiet) voidSets the SCM that should be used to find the reference build for.voidsetSkipBlames(boolean skipBlames) voidsetSkipDeltaCalculation(boolean skipDeltaCalculation) voidsetSkipPostProcessing(boolean skipPostProcessing) voidsetSkipPublishingChecks(boolean skipPublishingChecks) 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> sourceDirectories) Sets the paths to the directories that contain the source code.voidsetToolProxies(List<ToolProxy> toolProxies) Deprecated.this method is only intended to be called by the UIvoidSets the static analysis tools that will scan files and create issues.voidSets the static analysis tools that will scan files and create issues.voidsetTrendChartType(TrendChartType trendChartType) Sets the type of the trend chart that should be shown on the job page.voidsetUnhealthy(int unhealthy) Sets the healthy threshold, i.e., the number of issues when health is reported as 0%.Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, prebuild
-
Constructor Details
-
IssuesRecorder
@DataBoundConstructor public IssuesRecorder()Creates a new instance ofIssuesRecorder.
-
-
Method Details
-
readResolve
Called after deserialization to retain backward compatibility or to populate new elements (that would be otherwise initialized tonull).- Returns:
- this
-
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
-
setQualityGates
Defines the optional list of quality gates.- Parameters:
qualityGates- the quality gates
-
getQualityGates
-
setId
Defines the ID of the results. The ID is used as URL of the results and as name in UI elements. If no ID is given, then the ID of the associated result object is used.Note: this property is not used if
isAggregatingResultsisfalse. It is also not visible in the UI in order to simplify the user interface.- Parameters:
id- the ID of the results
-
getId
-
setName
Defines the name of the results. The name is used for all labels in the UI. If no name is given, then the name of the associatedStaticAnalysisLabelProvideris used.Note: this property is not used if
isAggregatingResultsisfalse. It is also not visible in the UI in order to simplify the user interface.- Parameters:
name- the name of the results
-
getName
-
setIcon
Defines the custom icon of the results. If no icon is given, then the default icon of the associatedStaticAnalysisLabelProvideris used.- Parameters:
icon- the icon of the results
-
getIcon
-
getToolProxies
Deprecated.this method is only intended to be called by the UIGets the static analysis tools that will scan files and create issues.- Returns:
- the static analysis tools (wrapped as
ToolProxy) - See Also:
-
setToolProxies
Deprecated.this method is only intended to be called by the UISets the static analysis tools that will scan files and create issues.- Parameters:
toolProxies- the static analysis tools (wrapped asToolProxy)- See Also:
-
setTools
Sets the static analysis tools that will scan files and create issues.- Parameters:
tools- the static analysis tools
-
setTools
Sets the static analysis tools that will scan files and create issues.- Parameters:
tool- the static analysis tooladditionalTools- additional static analysis tools (might be empty)- See Also:
-
getTools
Returns the static analysis tools that will scan files and create issues.- Returns:
- the static analysis tools
-
getSourceCodeEncoding
-
setSourceCodeEncoding
Sets the encoding to use to read source files.- Parameters:
sourceCodeEncoding- the encoding, e.g. "ISO-8859-1"
-
setSourceDirectories
@DataBoundSetter public void setSourceDirectories(List<io.jenkins.plugins.prism.SourceCodeDirectory> sourceDirectories) 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:
sourceDirectories- 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() -
getAggregatingResults
public boolean getAggregatingResults()Returns whether the results for each configured static analysis result should be aggregated into a single result or if every tool should get an individual result.- Returns:
trueif the results of each static analysis tool should be aggregated into a single result,falseif every tool should get an individual result.
-
setAggregatingResults
@DataBoundSetter public void setAggregatingResults(boolean aggregatingResults) -
isQuiet
public boolean isQuiet()Returns whether report logging should be enabled.- Returns:
truereport logging is disabledfalsereport logging is enabled
-
setQuiet
@DataBoundSetter public void setQuiet(boolean quiet) -
getBlameDisabled
public boolean getBlameDisabled()Returns whether the SCM blaming should be disabled.- Returns:
trueif SCM blaming should be disabled
-
setBlameDisabled
@DataBoundSetter public void setBlameDisabled(boolean blameDisabled) -
isSkipBlames
public boolean isSkipBlames()Returns whether the SCM blaming should be disabled.- Returns:
trueif SCM blaming should be disabled
-
setSkipBlames
@DataBoundSetter public void setSkipBlames(boolean skipBlames) -
isSkipPublishingChecks
public boolean isSkipPublishingChecks()Returns whether publishing checks should be skipped.- Returns:
trueif publishing checks should be skipped,falseotherwise
-
setSkipPublishingChecks
@DataBoundSetter public void setSkipPublishingChecks(boolean skipPublishingChecks) -
setChecksAnnotationScope
@DataBoundSetter public void setChecksAnnotationScope(io.jenkins.plugins.analysis.core.steps.WarningChecksPublisher.ChecksAnnotationScope checksAnnotationScope) Sets the scope of the annotations that should be published to SCM checks.- Parameters:
checksAnnotationScope- the scope to use
-
getChecksAnnotationScope
public io.jenkins.plugins.analysis.core.steps.WarningChecksPublisher.ChecksAnnotationScope getChecksAnnotationScope() -
isSkipPostProcessing
public boolean isSkipPostProcessing()Returns whether post-processing of the issues should be disabled.- Returns:
trueif post-processing of the issues should be disabled.
-
setSkipPostProcessing
@DataBoundSetter public void setSkipPostProcessing(boolean skipPostProcessing) -
isSkipDeltaCalculation
public boolean isSkipDeltaCalculation()Returns whether the SCM delta calculation for the new issue detection should be disabled.- Returns:
trueif the SCM delta calculation for the new issue detection should be disabled.
-
setSkipDeltaCalculation
@DataBoundSetter public void setSkipDeltaCalculation(boolean skipDeltaCalculation) -
setFailOnError
@DataBoundSetter public void setFailOnError(boolean failOnError) Determines whether to fail the step on errors during the step of recording issues.- Parameters:
failOnError- iftruethen the build will be failed on errors,falsethen errors are only reported in the UI
-
getFailOnError
public boolean getFailOnError() -
getEnabledForFailure
public boolean getEnabledForFailure()Returns whether recording should be enabled for failed builds as well.- Returns:
trueif recording should be enabled for failed builds as well,falseif recording is enabled for successful or unstable builds only
-
setEnabledForFailure
@DataBoundSetter public void setEnabledForFailure(boolean enabledForFailure) -
setIgnoreQualityGate
@DataBoundSetter public void setIgnoreQualityGate(boolean ignoreQualityGate) Iftrue, then the result of the quality gate is ignored when selecting a reference build. This option is disabled by default so a failing quality gate will be passed from build to build until the original reason for the failure has been resolved.- Parameters:
ignoreQualityGate- iftruethen the result of the quality gate is ignored, otherwise only build with a successful quality gate are selected
-
getIgnoreQualityGate
public boolean getIgnoreQualityGate() -
getHealthy
public int getHealthy() -
setHealthy
@DataBoundSetter public void setHealthy(int healthy) Sets the healthy threshold, i.e. the number of issues when health is reported as 100%.- Parameters:
healthy- the number of issues when health is reported as 100%
-
getUnhealthy
public int getUnhealthy() -
setUnhealthy
@DataBoundSetter public void setUnhealthy(int unhealthy) Sets the healthy threshold, i.e., the number of issues when health is reported as 0%.- Parameters:
unhealthy- the number of issues when health is reported as 0%
-
getMinimumSeverity
-
setTrendChartType
Sets the type of the trend chart that should be shown on the job page.- Parameters:
trendChartType- the type of the trend chart to use
-
getTrendChartType
-
setMinimumSeverity
Sets the minimum severity to consider when computing the health report. Issues with a severity less than this value will be ignored.- Parameters:
minimumSeverity- the severity to consider
-
getFilters
-
setFilters
-
setChecksInfo
public void setChecksInfo(@CheckForNull io.jenkins.plugins.checks.steps.ChecksInfo checksInfo) -
getRequiredMonitorService
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Publisher>- Overrides:
getDescriptorin classRecorder
-
perform
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException- Specified by:
performin interfaceBuildStep- Overrides:
performin classBuildStepCompatibilityLayer- Throws:
InterruptedExceptionIOException
-