Use a simpler solution to limit concurrent Jenkins builds
See https://issues.jenkins.io/browse/JENKINS-43353?focusedCommentId=414847&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-414847
This commit is contained in:
parent
51e556ebde
commit
a290e85b14
|
@ -16,14 +16,6 @@ import org.hibernate.jenkins.pipeline.helpers.job.JobHelper
|
||||||
@Field final String NODE_PATTERN_BASE = 'Worker&&Containers'
|
@Field final String NODE_PATTERN_BASE = 'Worker&&Containers'
|
||||||
@Field List<BuildEnvironment> environments
|
@Field List<BuildEnvironment> 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)
|
this.helper = new JobHelper(this)
|
||||||
|
|
||||||
helper.runWithNotification {
|
helper.runWithNotification {
|
||||||
|
@ -63,6 +55,9 @@ stage('Configure') {
|
||||||
buildDiscarder(
|
buildDiscarder(
|
||||||
logRotator(daysToKeepStr: '90')
|
logRotator(daysToKeepStr: '90')
|
||||||
),
|
),
|
||||||
|
// If two builds are about the same branch or pull request,
|
||||||
|
// the older one will be aborted when the newer one starts.
|
||||||
|
disableConcurrentBuilds(abortPrevious: true),
|
||||||
helper.generateNotificationProperty()
|
helper.generateNotificationProperty()
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue