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
On which type of metric change a build should fail
Immediately stop the build if it fails due to this failure condition
Threshold for build failure. A build will fail when a metric is changed more significantly than the specified threshold. Threshold change is treated according to the selected units. If not specified, the default value 1 is used.
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