Class QualityGate
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<QualityGate>
-
- io.jenkins.plugins.analysis.core.util.QualityGate
-
- All Implemented Interfaces:
Describable<QualityGate>
,Serializable
public class QualityGate extends AbstractDescribableImpl<QualityGate> implements Serializable
Defines a quality gate based on a specific threshold of issues (total, new, delta) in the current build. After a build has been finished, a set ofquality gates
will be evaluated and the overall quality gate status will be reported in Jenkins UI.- Author:
- Ullrich Hafner
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QualityGate.QualityGateDescriptor
Descriptor of theQualityGate
.static class
QualityGate.QualityGateResult
Determines the Jenkins build result if the quality gate is failed.static class
QualityGate.QualityGateType
Available quality gate types.
-
Constructor Summary
Constructors Constructor Description QualityGate(int threshold, QualityGate.QualityGateType type, boolean unstable)
Creates a new instance ofQualityGate
.QualityGate(int threshold, QualityGate.QualityGateType type, QualityGate.QualityGateResult result)
Creates a new instance ofQualityGate
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Function<IssuesStatistics,Integer>
getActualSizeMethodReference()
Returns the method that should be used to determine the actual number of issues in the build.String
getName()
Returns the human-readable name of the quality gate.QualityGate.QualityGateResult
getResult()
Returns the quality gate status to set if the quality gate is failed.QualityGateStatus
getStatus()
Returns the quality gate status to set if the quality gate is failed.int
getThreshold()
Returns the minimum number of issues that will fail the quality gate.QualityGate.QualityGateType
getType()
boolean
getUnstable()
boolean
getWarning()
int
hashCode()
static List<QualityGate>
map(Thresholds thresholds)
Maps the old styleThresholds
to the new style list ofQualityGate
instances.-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Constructor Detail
-
QualityGate
@DataBoundConstructor public QualityGate(int threshold, QualityGate.QualityGateType type, boolean unstable)
Creates a new instance ofQualityGate
.- Parameters:
threshold
- the minimum number of issues that fails the quality gatetype
- the type of the quality gateunstable
- determines whether the build result will be set to unstable or failed if the quality gate is failed
-
QualityGate
public QualityGate(int threshold, QualityGate.QualityGateType type, QualityGate.QualityGateResult result)
Creates a new instance ofQualityGate
.- Parameters:
threshold
- 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
-
-
Method Detail
-
getUnstable
public boolean getUnstable()
-
getType
public QualityGate.QualityGateType getType()
-
getWarning
public boolean getWarning()
-
getThreshold
public int getThreshold()
Returns the minimum number of issues that will fail the quality gate.- Returns:
- minimum number of issues
-
getActualSizeMethodReference
public Function<IssuesStatistics,Integer> getActualSizeMethodReference()
Returns the method that should be used to determine the actual number of issues in the build.- Returns:
- threshold getter
-
getName
public String getName()
Returns the human-readable name of the quality gate.- Returns:
- the human-readable name
-
getStatus
public QualityGateStatus getStatus()
Returns the quality gate status to set if the quality gate is failed.- Returns:
- the status
-
getResult
public QualityGate.QualityGateResult getResult()
Returns the quality gate status to set if the quality gate is failed.- Returns:
- the status
-
map
public static List<QualityGate> map(@CheckForNull Thresholds thresholds)
Maps the old styleThresholds
to the new style list ofQualityGate
instances.- Parameters:
thresholds
- the thresholds- Returns:
- the list of quality gates
-
-