• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • workflow-job-plugin
    • None
    • 2.42

      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)
      

          [JENKINS-43353] Ability to abort all previous running builds

          Jesse Glick created issue -
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-40936 [ JENKINS-40936 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 12 (Web Link)" [ 15849 ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-39180 [ JENKINS-39180 ]
          Nicholas Brown made changes -
          Link New: This issue is related to JENKINS-43132 [ JENKINS-43132 ]
          Nicholas Brown made changes -
          Link New: This issue is related to JENKINS-47503 [ JENKINS-47503 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 19 (Web Link)" [ 22716 ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-58625 [ JENKINS-58625 ]
          Jesse Glick made changes -
          Description Original: 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.
          New: 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}
          Donald Morton made changes -
          Attachment New: thread_dump_081720.txt [ 52235 ]
          Jesse Glick made changes -
          Assignee Original: Antonio Muñiz [ amuniz ] New: Jesse Glick [ jglick ]

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

              Created:
              Updated:
              Resolved: