Build Failure On Metric
A build failure condition failing build on metric change.
Example. Fail build if the size of its artifacts decreases by 10% comparing to the last successful build.
buildType {
// Other Build Type settings ...
failureConditions {
// Other Failure Conditions ...
failOnMetricChange {
metric = BuildFailureOnMetric.MetricType.ARTIFACT_SIZE
threshold = 10
units = BuildFailureOnMetric.MetricUnit.PERCENTS
comparison = BuildFailureOnMetric.MetricComparison.LESS
compareTo = build {
buildRule = lastSuccessful()
}
}
Content copied to clipboard }
}
Example. Fail build if number of ignored tests exceeds 100.
buildType {
// Other Build Type settings ...
failureConditions {
// Other Failure Conditions ...
failOnMetricChange {
metric = BuildFailureOnMetric.MetricType.TEST_IGNORED_COUNT
threshold = 100
units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT
comparison = BuildFailureOnMetric.MetricComparison.MORE
compareTo = value()
}
Content copied to clipboard }
}
See also
Types
Properties
Specifies which value should be compared to the metric value in the build
On which type of metric change a build should fail
Type of the metric
Immediately stop the build if it fails due to this failure condition
Specifies the unit of the given threshold (default metric units or percents)
Functions
The metric value in the build should be compared to the metric value from a build matched by the rule
Copies parameters of this object to the specified target
Creates an instance of this build feature via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.
Validates this object and reports found errors to the provided consumer
The metric value in the build should be compared to the threshold