Class RecordIssuesStep
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<org.jenkinsci.plugins.workflow.steps.Step>
-
- org.jenkinsci.plugins.workflow.steps.Step
-
- io.jenkins.plugins.analysis.core.steps.RecordIssuesStep
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<org.jenkinsci.plugins.workflow.steps.Step>
,Serializable
public class RecordIssuesStep extends org.jenkinsci.plugins.workflow.steps.Step implements Serializable
Pipeline step that scans report files or the console log for issues. Stores the created issues in anAnalysisResult
. The result is attached to theRun
by registering aResultAction
.Additional features:
- It provides a
QualityGateEvaluator
that is checked after each run. If the quality gate is not passed, then the build will be set toResult.UNSTABLE
orResult.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
HealthReportBuilder
to compute the health and the health trend graph.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RecordIssuesStep.Descriptor
Descriptor for this step: defines the context and the UI labels.-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description RecordIssuesStep()
Creates a new instance ofRecordIssuesStep
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addQualityGate(int size, QualityGate.QualityGateType type, QualityGate.QualityGateResult result)
Appends the specified quality gates to the end of the list of quality gates.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.boolean
getBlameDisabled()
Deprecated.useisSkipBlames()
boolean
getEnabledForFailure()
Returns whether recording should be enabled for failed builds as well.int
getFailedNewAll()
Deprecated.replaced bygetQualityGates()
int
getFailedNewHigh()
Deprecated.replaced bygetQualityGates()
int
getFailedNewLow()
Deprecated.replaced bygetQualityGates()
int
getFailedNewNormal()
Deprecated.replaced bygetQualityGates()
int
getFailedTotalAll()
Deprecated.replaced bygetQualityGates()
int
getFailedTotalHigh()
Deprecated.replaced bygetQualityGates()
int
getFailedTotalLow()
Deprecated.replaced bygetQualityGates()
int
getFailedTotalNormal()
Deprecated.replaced bygetQualityGates()
boolean
getFailOnError()
List<RegexpFilter>
getFilters()
boolean
getForensicsDisabled()
Deprecated.Forensics will be automatically skipped if the Forensics recorder is not activated.int
getHealthy()
String
getId()
boolean
getIgnoreFailedBuilds()
boolean
getIgnoreQualityGate()
String
getMinimumSeverity()
String
getName()
List<QualityGate>
getQualityGates()
String
getReferenceBuildId()
Returns the reference build id of the reference job to get the results for the issue difference computation.String
getReferenceJobName()
Returns the reference job to get the results for the issue difference computation.String
getScm()
String
getSourceCodeEncoding()
List<io.jenkins.plugins.prism.SourceCodeDirectory>
getSourceDirectories()
String
getSourceDirectory()
Tool
getTool()
Always returnsnull
.List<ToolProxy>
getToolProxies()
Deprecated.this method is only intended to be called by the UIList<Tool>
getTools()
Returns the static analysis tools that will scan files and create issues.TrendChartType
getTrendChartType()
int
getUnhealthy()
int
getUnstableNewAll()
Deprecated.replaced bygetQualityGates()
int
getUnstableNewHigh()
Deprecated.replaced bygetQualityGates()
int
getUnstableNewLow()
Deprecated.replaced bygetQualityGates()
int
getUnstableNewNormal()
Deprecated.replaced bygetQualityGates()
int
getUnstableTotalAll()
Deprecated.replaced bygetQualityGates()
int
getUnstableTotalHigh()
Deprecated.replaced bygetQualityGates()
int
getUnstableTotalLow()
Deprecated.replaced bygetQualityGates()
int
getUnstableTotalNormal()
Deprecated.replaced bygetQualityGates()
boolean
isPublishAllIssues()
Returns whether all issues should be published using the Checks API.boolean
isSkipBlames()
Returns whether SCM blaming should be disabled.boolean
isSkipPublishingChecks()
Returns whether publishing checks should be skipped.void
setAggregatingResults(boolean aggregatingResults)
void
setBlameDisabled(boolean blameDisabled)
Deprecated.void
setEnabledForFailure(boolean enabledForFailure)
void
setFailedNewAll(int size)
Deprecated.void
setFailedNewHigh(int size)
Deprecated.void
setFailedNewLow(int size)
Deprecated.void
setFailedNewNormal(int size)
Deprecated.void
setFailedTotalAll(int size)
Deprecated.void
setFailedTotalHigh(int size)
Deprecated.void
setFailedTotalLow(int size)
Deprecated.void
setFailedTotalNormal(int size)
Deprecated.void
setFailOnError(boolean failOnError)
Determines whether to fail the build on errors during the step of recording issues.void
setFilters(List<RegexpFilter> filters)
void
setForensicsDisabled(boolean forensicsDisabled)
Deprecated.Forensics will be automatically skipped if the Forensics recorder is not activated.void
setHealthy(int healthy)
Sets the healthy threshold, i.e.void
setId(String id)
Defines the ID of the results.void
setIgnoreFailedBuilds(boolean ignoreFailedBuilds)
Iftrue
, then only successful or unstable reference builds will be considered.void
setIgnoreQualityGate(boolean ignoreQualityGate)
Iftrue
, then the result of the quality gate is ignored when selecting a reference build.void
setMinimumSeverity(String minimumSeverity)
Sets the minimum severity to consider when computing the health report.void
setName(String name)
Defines the name of the results.void
setPublishAllIssues(boolean publishAllIssues)
void
setQualityGates(List<QualityGate> qualityGates)
Defines the optional list of quality gates.void
setReferenceBuildId(String referenceBuildId)
Sets the reference build id of the reference job for the issue difference computation.void
setReferenceJobName(String referenceJobName)
Sets the reference job to get the results for the issue difference computation.void
setScm(String scm)
Sets the SCM that should be used to find the reference build for.void
setSkipBlames(boolean skipBlames)
void
setSkipPublishingChecks(boolean skipPublishingChecks)
void
setSourceCodeEncoding(String sourceCodeEncoding)
Sets the encoding to use to read source files.void
setSourceDirectories(List<io.jenkins.plugins.prism.SourceCodeDirectory> sourceDirectories)
Sets the paths to the directories that contain the source code.void
setSourceDirectory(String sourceDirectory)
Sets the path to the folder that contains the source code.void
setTool(Tool tool)
Sets the static analysis tool that will scan files and create issues.void
setToolProxies(List<ToolProxy> toolProxies)
Deprecated.this method is only intended to be called by the UIvoid
setTools(Tool tool, Tool... additionalTools)
Sets the static analysis tools that will scan files and create issues.void
setTools(List<Tool> tools)
Sets the static analysis tools that will scan files and create issues.void
setTrendChartType(TrendChartType trendChartType)
Sets the type of the trend chart that should be shown on the job page.void
setUnhealthy(int unhealthy)
Sets the healthy threshold, i.e.void
setUnstableNewAll(int size)
Deprecated.void
setUnstableNewHigh(int size)
Deprecated.void
setUnstableNewLow(int size)
Deprecated.void
setUnstableNewNormal(int size)
Deprecated.void
setUnstableTotalAll(int size)
Deprecated.void
setUnstableTotalHigh(int size)
Deprecated.void
setUnstableTotalLow(int size)
Deprecated.void
setUnstableTotalNormal(int size)
Deprecated.org.jenkinsci.plugins.workflow.steps.StepExecution
start(org.jenkinsci.plugins.workflow.steps.StepContext context)
-
-
-
Constructor Detail
-
RecordIssuesStep
@DataBoundConstructor public RecordIssuesStep()
Creates a new instance ofRecordIssuesStep
.
-
-
Method Detail
-
setScm
@DataBoundSetter public void setScm(String scm)
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
public String getScm()
-
setQualityGates
@DataBoundSetter public void setQualityGates(List<QualityGate> qualityGates)
Defines the optional list of quality gates.- Parameters:
qualityGates
- the quality gates
-
addQualityGate
public void addQualityGate(int size, QualityGate.QualityGateType type, QualityGate.QualityGateResult result)
Appends the specified quality gates to the end of the list of quality gates.- Parameters:
size
- the minimum number of issues that fails the quality gatetype
- the type of the quality gateresult
- determines whether the quality gate is a warning or failure
-
getQualityGates
public List<QualityGate> getQualityGates()
-
setUnstableTotalAll
@Deprecated @DataBoundSetter public void setUnstableTotalAll(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableTotalAll
@Deprecated public int getUnstableTotalAll()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableTotalHigh
@Deprecated @DataBoundSetter public void setUnstableTotalHigh(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableTotalHigh
@Deprecated public int getUnstableTotalHigh()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableNewAll
@Deprecated @DataBoundSetter public void setUnstableNewAll(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableNewAll
@Deprecated public int getUnstableNewAll()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableTotalNormal
@Deprecated @DataBoundSetter public void setUnstableTotalNormal(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableTotalNormal
@Deprecated public int getUnstableTotalNormal()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableTotalLow
@Deprecated @DataBoundSetter public void setUnstableTotalLow(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableTotalLow
@Deprecated public int getUnstableTotalLow()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableNewHigh
@Deprecated @DataBoundSetter public void setUnstableNewHigh(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableNewHigh
@Deprecated public int getUnstableNewHigh()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableNewNormal
@Deprecated @DataBoundSetter public void setUnstableNewNormal(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableNewNormal
@Deprecated public int getUnstableNewNormal()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setUnstableNewLow
@Deprecated @DataBoundSetter public void setUnstableNewLow(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getUnstableNewLow
@Deprecated public int getUnstableNewLow()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedTotalAll
@Deprecated @DataBoundSetter public void setFailedTotalAll(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedTotalAll
@Deprecated public int getFailedTotalAll()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedTotalHigh
@Deprecated @DataBoundSetter public void setFailedTotalHigh(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedTotalHigh
@Deprecated public int getFailedTotalHigh()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedTotalNormal
@Deprecated @DataBoundSetter public void setFailedTotalNormal(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedTotalNormal
@Deprecated public int getFailedTotalNormal()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedTotalLow
@Deprecated @DataBoundSetter public void setFailedTotalLow(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedTotalLow
@Deprecated public int getFailedTotalLow()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedNewAll
@Deprecated @DataBoundSetter public void setFailedNewAll(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedNewAll
@Deprecated public int getFailedNewAll()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedNewHigh
@Deprecated @DataBoundSetter public void setFailedNewHigh(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedNewHigh
@Deprecated public int getFailedNewHigh()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedNewNormal
@Deprecated @DataBoundSetter public void setFailedNewNormal(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedNewNormal
@Deprecated public int getFailedNewNormal()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setFailedNewLow
@Deprecated @DataBoundSetter public void setFailedNewLow(int size)
Deprecated.Sets the quality gate.- Parameters:
size
- number of issues
-
getFailedNewLow
@Deprecated public int getFailedNewLow()
Deprecated.replaced bygetQualityGates()
Gets the quality gate.- Returns:
- 0
-
setId
@DataBoundSetter public void setId(String id)
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
isAggregatingResults
isfalse
. It is also not visible in the UI in order to simplify the user interface.- Parameters:
id
- the ID of the results
-
getId
public String getId()
-
setName
@DataBoundSetter public void setName(String name)
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 associatedStaticAnalysisLabelProvider
is used.Note: this property is not used if
isAggregatingResults
isfalse
. It is also not visible in the UI in order to simplify the user interface.- Parameters:
name
- the name of the results
-
getName
public String getName()
-
getToolProxies
@CheckForNull @Deprecated public List<ToolProxy> 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:
getTools()
-
setToolProxies
@DataBoundSetter @Deprecated public void setToolProxies(List<ToolProxy> toolProxies)
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(List)
,setTool(Tool)
-
setTools
@DataBoundSetter public void setTools(List<Tool> tools)
Sets the static analysis tools that will scan files and create issues.- Parameters:
tools
- the static analysis tools- See Also:
setTool(Tool)
-
setTools
public void setTools(Tool tool, Tool... additionalTools)
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:
setTool(Tool)
,setTools(List)
-
getTools
public List<Tool> getTools()
Returns the static analysis tools that will scan files and create issues.- Returns:
- the static analysis tools
-
setTool
@DataBoundSetter public void setTool(Tool tool)
Sets the static analysis tool that will scan files and create issues.- Parameters:
tool
- the static analysis tool
-
getTool
@CheckForNull public Tool getTool()
Always returnsnull
. Note: this method is required for Jenkins data binding.- Returns:
null
-
getSourceCodeEncoding
@CheckForNull public String getSourceCodeEncoding()
-
setSourceCodeEncoding
@DataBoundSetter public void setSourceCodeEncoding(String sourceCodeEncoding)
Sets the encoding to use to read source files.- Parameters:
sourceCodeEncoding
- the encoding, e.g. "ISO-8859-1"
-
getSourceDirectory
public String getSourceDirectory()
-
setSourceDirectory
@DataBoundSetter public void setSourceDirectory(String sourceDirectory)
Sets the path to the folder that contains the source code. If not relative and thus not part of the workspace then this folder needs to be added in Jenkins global configuration.- Parameters:
sourceDirectory
- a folder containing the source code
-
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
public List<io.jenkins.plugins.prism.SourceCodeDirectory> getSourceDirectories()
-
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:
true
if the results of each static analysis tool should be aggregated into a single result,false
if every tool should get an individual result.
-
setAggregatingResults
@DataBoundSetter public void setAggregatingResults(boolean aggregatingResults)
-
getBlameDisabled
@Deprecated public boolean getBlameDisabled()
Deprecated.useisSkipBlames()
Returns whether SCM blaming should be disabled.- Returns:
true
if SCM blaming should be disabled
-
setBlameDisabled
@Deprecated @DataBoundSetter public void setBlameDisabled(boolean blameDisabled)
Deprecated.Determines whether to skip the SCM blaming.- Parameters:
blameDisabled
-true
if SCM blaming should be disabled
-
isSkipBlames
public boolean isSkipBlames()
Returns whether SCM blaming should be disabled.- Returns:
true
if SCM blaming should be disabled
-
setSkipBlames
@DataBoundSetter public void setSkipBlames(boolean skipBlames)
-
getForensicsDisabled
@Deprecated public boolean getForensicsDisabled()
Deprecated.Forensics will be automatically skipped if the Forensics recorder is not activated.Not used anymore.- Returns:
true
if SCM forensics should be disabled
-
setForensicsDisabled
@DataBoundSetter @Deprecated public void setForensicsDisabled(boolean forensicsDisabled)
Deprecated.Forensics will be automatically skipped if the Forensics recorder is not activated.Not used anymore.- Parameters:
forensicsDisabled
- not used
-
isSkipPublishingChecks
public boolean isSkipPublishingChecks()
Returns whether publishing checks should be skipped.- Returns:
true
if publishing checks should be skipped,false
otherwise
-
setSkipPublishingChecks
@DataBoundSetter public void setSkipPublishingChecks(boolean skipPublishingChecks)
-
isPublishAllIssues
public boolean isPublishAllIssues()
Returns whether all issues should be published using the Checks API. If set tofalse
only new issues will be published.- Returns:
true
if all issues should be published,false
if only new issues should be published
-
setPublishAllIssues
@DataBoundSetter public void setPublishAllIssues(boolean publishAllIssues)
-
getEnabledForFailure
public boolean getEnabledForFailure()
Returns whether recording should be enabled for failed builds as well.- Returns:
true
if recording should be enabled for failed builds as well,false
if 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
- iftrue
then the result of the quality gate is ignored, otherwise only build with a successful quality gate are selected
-
getIgnoreQualityGate
public boolean getIgnoreQualityGate()
-
setIgnoreFailedBuilds
@DataBoundSetter public void setIgnoreFailedBuilds(boolean ignoreFailedBuilds)
Iftrue
, then only successful or unstable reference builds will be considered. This option is enabled by default, since analysis results might be inaccurate if the build failed. Iffalse
, every build that contains a static analysis result is considered, even if the build failed.- Parameters:
ignoreFailedBuilds
- iftrue
then a stable build is used as reference
-
getIgnoreFailedBuilds
public boolean getIgnoreFailedBuilds()
-
setFailOnError
@DataBoundSetter public void setFailOnError(boolean failOnError)
Determines whether to fail the build on errors during the step of recording issues.- Parameters:
failOnError
- iftrue
then the build will be failed on errors,false
then errors are only reported in the UI
-
getFailOnError
public boolean getFailOnError()
-
setReferenceJobName
@DataBoundSetter public void setReferenceJobName(String referenceJobName)
Sets the reference job to get the results for the issue difference computation.- Parameters:
referenceJobName
- the name of reference job
-
getReferenceJobName
public String getReferenceJobName()
Returns the reference job to get the results for the issue difference computation. If the job is not defined, thenIssuesRecorder.NO_REFERENCE_DEFINED
is returned.- Returns:
- the name of reference job, or
IssuesRecorder.NO_REFERENCE_DEFINED
if undefined
-
setReferenceBuildId
@DataBoundSetter public void setReferenceBuildId(String referenceBuildId)
Sets the reference build id of the reference job for the issue difference computation.- Parameters:
referenceBuildId
- the build id of the reference job
-
getReferenceBuildId
public String getReferenceBuildId()
Returns the reference build id of the reference job to get the results for the issue difference computation. If the build id is not defined, thenIssuesRecorder.NO_REFERENCE_DEFINED
is returned.- Returns:
- the reference build id, or
IssuesRecorder.NO_REFERENCE_DEFINED
if undefined
-
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
@CheckForNull public String getMinimumSeverity()
-
setMinimumSeverity
@DataBoundSetter public void setMinimumSeverity(String minimumSeverity)
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
-
setTrendChartType
@DataBoundSetter public void setTrendChartType(TrendChartType trendChartType)
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
public TrendChartType getTrendChartType()
-
getFilters
public List<RegexpFilter> getFilters()
-
setFilters
@DataBoundSetter public void setFilters(List<RegexpFilter> filters)
-
start
public org.jenkinsci.plugins.workflow.steps.StepExecution start(org.jenkinsci.plugins.workflow.steps.StepContext context)
- Specified by:
start
in classorg.jenkinsci.plugins.workflow.steps.Step
-
-