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

Milestone can be passed by older build if another build exits early

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      See attached Jenkinsfile, containing an initial input step and then several milestones.  The stage blocks make the problem a bit more visible in the pipeline view, but I can reproduce the issue without them.

      Steps to reproduce:

      1. Create a job with this Jenkinsfile.
      2. Start three builds.  They all pause for input.
      3. On the newest build (#3), click continue. It completes each stage successfully.
      4. On the oldest build (#1), click continue. It fails at the first milestone as expected.
      5. On the middle build (#2), click continue.

      Expected results:

      The middle build should stop at the first milestone.

      Actual results:

      The middle build continues successfully through the milestones until reaching the final milestone.  Only the final milestone fails.

      The impact of this could be quite high if the milestones are controlling access to deploy steps, as it could lead to older builds being deployed unexpectedly.

      Possible workaround

      Add an extra milestone at the start of the script, before the input step.  Earlier jobs are then killed when the newest job continues.

       

        Attachments

          Activity

          Hide
          timretout Tim Retout added a comment -

          I'm seeing the same behaviour if the builds are instead allowed through in the order #3, #2, #1 - in this case build #2 fails at the first milestone, and build #1 passes all but the final milestone.

          Show
          timretout Tim Retout added a comment - I'm seeing the same behaviour if the builds are instead allowed through in the order #3, #2, #1 - in this case build #2 fails at the first milestone, and build #1 passes all but the final milestone.
          Hide
          timretout Tim Retout added a comment -

          I've converted this into a failing test case:

          https://github.com/jenkinsci/pipeline-milestone-step-plugin/pull/13

          Show
          timretout Tim Retout added a comment - I've converted this into a failing test case: https://github.com/jenkinsci/pipeline-milestone-step-plugin/pull/13
          Hide
          timretout Tim Retout added a comment -

          I can get my test to pass by commenting out the section starting "// Clean up non-existing milestones" in the exit() method of MilestoneStepExecution.  I think that that method should not clean up milestones if the current build was exited early?

          Show
          timretout Tim Retout added a comment - I can get my test to pass by commenting out the section starting "// Clean up non-existing milestones" in the exit() method of MilestoneStepExecution.  I think that that method should not clean up milestones if the current build was exited early?
          Hide
          tkleiber Torsten Kleiber added a comment -

          The mentioned workaround unfortunatly means running in another bug: https://issues.jenkins-ci.org/browse/JENKINS-49447

          Show
          tkleiber Torsten Kleiber added a comment - The mentioned workaround unfortunatly means running in another bug: https://issues.jenkins-ci.org/browse/JENKINS-49447

            People

            • Assignee:
              amuniz Antonio Muñiz
              Reporter:
              timretout Tim Retout
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: