diff --git a/Jenkinsfile b/Jenkinsfile index e5db903889..ef3f147763 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,14 @@ import org.hibernate.jenkins.pipeline.helpers.job.JobHelper @Field final String NODE_PATTERN_BASE = 'Worker&&Containers' @Field List environments +// Cancel previous runs automatically by reaching milestones +// See https://issues.jenkins.io/browse/JENKINS-43353 +def buildNumber = BUILD_NUMBER as int; +if (buildNumber > 1) { + milestone(buildNumber - 1) +} +milestone(buildNumber) + this.helper = new JobHelper(this) helper.runWithNotification {