Skip to content

Conversation

jglick
Copy link
Member

@jglick jglick commented Jun 30, 2021

JENKINS-43353, more straightforward and efficient than using the previous hack

def buildNumber = BUILD_NUMBER as int; if (buildNumber > 1) milestone(buildNumber - 1); milestone(buildNumber)

Can be configured via GUI (for standalone Pipelines) or as code

properties([disableConcurrentBuilds(abortPrevious: true)])

https://github.com/jenkinsci/jenkins/blob/794770f7b27b323a42c07ae03d2cb64a0acb5a8d/core/src/main/java/hudson/model/Run.java#L352 sounds incorrect for `WorkflowRun`, which can survive restart.
https://github.com/jenkinsci/jenkins/blob/794770f7b27b323a42c07ae03d2cb64a0acb5a8d/core/src/main/java/hudson/model/Run.java#L910-L913 looks like it could break lazy-loading in some cases.
Anyway for purposes of this feature we really only care about the previous build:
there should not be _intermediate_ completed builds once this mode takes effect.
@timja timja requested review from dwnusbaum and car-roll October 12, 2021 13:48
@jglick
Copy link
Member Author

jglick commented Dec 6, 2021

@cathychan & @jtnord point out that when introducing this option for the first time, say to replace the milestone trick, you leave one extra build of an existing job running because the property is only interpreted when starting a build, not when the property is added (for example via properties step in Jenkinsfile). Probably DisableConcurrentBuildsJobProperty could be improved to override setOwner to immediately abort any running build(s) other than the latest.

jakubgs added a commit to status-im/status-mobile that referenced this pull request Jun 28, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jun 28, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jun 28, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jun 28, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jun 28, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jul 5, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jul 13, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
jakubgs added a commit to status-im/status-mobile that referenced this pull request Jul 13, 2022
jenkinsci/workflow-job-plugin#200
Removes the need to use our own convoluted implementation:
https://github.com/status-im/status-jenkins-lib/blob/17c1d0ea/vars/jenkins.groovy#L6-L27

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants