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

Ability to abort all previous running builds

    XMLWordPrintable

Details

    • 2.42

    Description

      It is sometimes desirable for a job (such as a branch project) to simply abort any previously running builds as soon as a new build starts. For example, in a branch project for a pull request, you might want to see test results from an earlier commit even after pushing follow-up commits, but most of the time you only care about the results of the PR head, and computer time might be too valuable to waste on the older ones.

      (I think gerrit-trigger does something like this automatically, and I have seen grayaii invent the same kind of pattern with JenkinsPy.)

      Merely setting the job to not be concurrent-capable does not suffice, since then newer builds will queue up waiting for the older ones to finish.


      Manual equivalent courtesy of bsquizz:

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

      Attachments

        Issue Links

          Activity

            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue relates to JENKINS-40936 [ JENKINS-40936 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 12 (Web Link)" [ 15849 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-39180 [ JENKINS-39180 ]
            nickbrown Nicholas Brown made changes -
            Link This issue is related to JENKINS-43132 [ JENKINS-43132 ]
            nickbrown Nicholas Brown made changes -
            Link This issue is related to JENKINS-47503 [ JENKINS-47503 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 19 (Web Link)" [ 22716 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-58625 [ JENKINS-58625 ]
            jglick Jesse Glick made changes -
            Description It is sometimes desirable for a job (such as a branch project) to simply abort any previously running builds as soon as a new build starts. For example, in a branch project for a pull request, you _might_ want to see test results from an earlier commit even after pushing follow-up commits, but most of the time you only care about the results of the PR head, and computer time might be too valuable to waste on the older ones.

            (I think {{gerrit-trigger}} does something like this automatically, and I have seen [~grayaii] invent the same kind of pattern with JenkinsPy.)

            Merely setting the job to not be concurrent-capable does not suffice, since then newer builds will queue up waiting for the older ones to finish.
            It is sometimes desirable for a job (such as a branch project) to simply abort any previously running builds as soon as a new build starts. For example, in a branch project for a pull request, you _might_ want to see test results from an earlier commit even after pushing follow-up commits, but most of the time you only care about the results of the PR head, and computer time might be too valuable to waste on the older ones.

            (I think {{gerrit-trigger}} does something like this automatically, and I have seen [~grayaii] invent the same kind of pattern with JenkinsPy.)

            Merely setting the job to not be concurrent-capable does not suffice, since then newer builds will queue up waiting for the older ones to finish.

            ----

            Manual equivalent courtesy of [~bsquizz]:

            {code}
            def buildNumber = BUILD_NUMBER as int; if (buildNumber > 1) milestone(buildNumber - 1); milestone(buildNumber)
            {code}
            d1morto Donald Morton made changes -
            Attachment thread_dump_081720.txt [ 52235 ]
            jglick Jesse Glick made changes -
            Assignee Antonio Muñiz [ amuniz ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Component/s workflow-job-plugin [ 21716 ]
            Component/s pipeline-milestone-step-plugin [ 21448 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-job-plugin #200 (Web Link)" [ 26807 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Released As 2.42
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Fixed but Unreleased [ 10203 ]
            jglick Jesse Glick made changes -
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]

            People

              jglick Jesse Glick
              jglick Jesse Glick
              Votes:
              31 Vote for this issue
              Watchers:
              42 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: