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

'Do not allow concurrent builds' in pipeline sometimes fails

      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?).

          [JENKINS-49820] 'Do not allow concurrent builds' in pipeline sometimes fails

          Mathias De Maré added a comment - Could this be the same as https://issues.jenkins-ci.org/browse/JENKINS-41127 ?

          Mathias De Maré added a comment - - edited

          This issue popped up again in the past week Is there any additional information that could help?

           

          Currently, we are running:

          • Jenkins 2.110
          • Job DSL 1.69
          • Pipeline 2.5

          Mathias De Maré added a comment - - edited This issue popped up again in the past week Is there any additional information that could help?   Currently, we are running: Jenkins 2.110 Job DSL 1.69 Pipeline 2.5

          Hi even we are facing this issue , any solution for this bug will help us

          Thanks

          suryatej yaramada added a comment - Hi even we are facing this issue , any solution for this bug will help us Thanks

          Hubert Li added a comment - - edited

          I got the same issue now and then. My DSL seed job is set concurrentBuild false.

          pipelineJob(jobName)
          {
              concurrentBuild(false)
          
          ...

          The pipeline job configured correctly with "Do not allow concurrent builds" on, but it builds two jobs parallel.

          My environment:

          • Jenkins 2.60.1
          • Job DSL 1.63
          • Pipeline 2.5

          Hubert Li added a comment - - edited I got the same issue now and then. My DSL seed job is set concurrentBuild false. pipelineJob(jobName) {     concurrentBuild( false ) ... The pipeline job configured correctly with "Do not allow concurrent builds" on, but it builds two jobs parallel. My environment: Jenkins 2.60.1 Job DSL 1.63 Pipeline 2.5

          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()  
            }
          }
          

          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() } }

          Hi daspilker , 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

          suryatej yaramada added a comment - Hi daspilker , 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

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

          Daniel Spilker added a comment - yrsurya Ask this on the Jenkins Users Mailing List. See https://jenkins.io/mailing-lists/ .

          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?

          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?

          Andrew C added a comment -

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

          I'd second what naiquevin 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.

           

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

          Andrew C added a comment - First, thank you to daspilker for your hard work on job-dsl. It's deeply appreciated. I'd second what naiquevin 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.   daspilker  – please let us know if there's anything we can do to help remedy this. Thank you.

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

              Created:
              Updated:
              Resolved: