Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49820

'Do not allow concurrent builds' in pipeline sometimes fails

    Details

    • Similar Issues:

      Description

      We noticed (every now and then) that some of our pipelines had issues. It appeared as if some jobs started while a previous pipeline was still ongoing (and the 'Do not allow concurrent builds' check was on).

      One of our developers wrote a script to check for this type of failure and got:

      PROBLEM: build 29319 started before build 29318 finished! (2017-08-31 13:42:41.952000 <= 2017-08-31 13:47:05.655000)

      PROBLEM: build 38584 started before build 38583 finished! (2017-10-25 13:54:31.601000 <= 2017-10-25 15:27:10.468000)

      PROBLEM: build 39219 started before build 39218 finished! (2018-01-02 08:01:47.422000 <= 2018-01-02 08:13:07.537000)

      PROBLEM: build 40171 started before build 40170 finished! (2018-02-15 14:58:57.194000 <= 2018-02-15 15:35:27.225000)

      PROBLEM: build 40356 started before build 40355 finished! (2018-02-23 13:31:02.287000 <= 2018-02-23 14:00:22.545000)

       

      We went over the times our Job DSL seed job ran and noticed a Job DSL seed job run ran every time the issue occurred.
      I tried to reproduce it with a simple 'sleep' pipeline, but the issue appears to require a more advanced pipeline (perhaps it only gets triggered when going from one step to another?).

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            This is an incarnation of JENKINS-31832. The many options available in the pipelineJob context are not suited for Pipeline jobs.

            The correct syntax to disable concurrent builds for Pipeline jobs is

            pipelineJob('example-pipeline') {
              properties {
                disableConcurrentBuilds()  
              }
            }
            
            Show
            daspilker Daniel Spilker added a comment - This is an incarnation of JENKINS-31832 . The many options available in the pipelineJob context are not suited for Pipeline jobs. The correct syntax to disable concurrent builds for Pipeline jobs is pipelineJob( 'example-pipeline' ) { properties { disableConcurrentBuilds() } }
            Hide
            yrsurya suryatej yaramada added a comment -

            Hi Daniel Spilker , we are using scripted pipeline DSL for all oyr projects so is there any way that we can configure this property into our projects so that we can rid of concurrent builds

            Appreciate for your reply

            Show
            yrsurya suryatej yaramada added a comment - Hi Daniel Spilker , we are using scripted pipeline DSL for all oyr projects so is there any way that we can configure this property into our projects so that we can rid of concurrent builds Appreciate for your reply
            Hide
            daspilker Daniel Spilker added a comment -

            suryatej yaramada Ask this on the Jenkins Users Mailing List. See https://jenkins.io/mailing-lists/.

            Show
            daspilker Daniel Spilker added a comment - suryatej yaramada Ask this on the Jenkins Users Mailing List. See https://jenkins.io/mailing-lists/ .
            Hide
            naiquevin Vineet Naik added a comment -

            Hi, we ran into this issue after recently upgrading jenkins and the plugins (including the job dsl plugin to 1.70). As mentioned in the previous comment, following fixed it

             pipelineJob('example-pipeline') { 
             properties { 
             disableConcurrentBuilds() 
             } 
            }

            Just want to point out that the docs are not updated with this - https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob-properties

            Side note: I think the deprecation handling would have been safer if the seed job failed with an error instead of silently ignoring it with a warning. In this particular case, the config not getting applied silently can have a significant impact. What do you think?

            Show
            naiquevin Vineet Naik added a comment - Hi, we ran into this issue after recently upgrading jenkins and the plugins (including the job dsl plugin to 1.70). As mentioned in the previous comment, following fixed it  pipelineJob( 'example-pipeline' ) { properties { disableConcurrentBuilds() } } Just want to point out that the docs are not updated with this - https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob-properties Side note: I think the deprecation handling would have been safer if the seed job failed with an error instead of silently ignoring it with a warning. In this particular case, the config not getting applied silently can have a significant impact. What do you think?
            Hide
            qxtmzwxmnghdkydg Andrew C added a comment -

            First, thank you to Daniel Spilker for your hard work on job-dsl. It's deeply appreciated.

            I'd second what Vineet Naik says above: the way this was deprecated is slightly confusing. The migration docs say the functionality is 'deprecated' and 'will be removed' in the future, and yet it appears to have been removed in 1.70 itself. We get a 'QUIET' log line from job-dsl's output, but nothing fails, and the fact that the official job-dsl docs still indicate that the old stuff should work in 1.70 is extra puzzling.

             

            Daniel Spilker – please let us know if there's anything we can do to help remedy this. Thank you.

            Show
            qxtmzwxmnghdkydg Andrew C added a comment - First, thank you to Daniel Spilker for your hard work on job-dsl. It's deeply appreciated. I'd second what Vineet Naik says above: the way this was deprecated is slightly confusing. The migration docs say the functionality is 'deprecated' and 'will be removed' in the future, and yet it appears to have been removed in 1.70 itself. We get a 'QUIET' log line from job-dsl's output, but nothing fails, and the fact that the official job-dsl docs still indicate that the old stuff should work in 1.70 is extra puzzling.   Daniel Spilker  – please let us know if there's anything we can do to help remedy this. Thank you.

              People

              • Assignee:
                daspilker Daniel Spilker
                Reporter:
                mathiasdm Mathias De Maré
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: