It would be nice the have the option to cancel ongoing builds for old patch sets when a new patch set is uploaded.

          [JENKINS-60301] Cancel builds on new patch sets

          Isn't it the way it works now? When a new PS gets pushed, the branch reindexing will remove the job of the old build, cancelling it if it's still active.

          What is instead the behaviour that you observe upon the upload of a new patch-set?

          Luca Domenico Milanesio added a comment - Isn't it the way it works now? When a new PS gets pushed, the branch reindexing will remove the job of the old build, cancelling it if it's still active. What is instead the behaviour that you observe upon the upload of a new patch-set?

          John V added a comment -

          Not from what I have seen, the project for the old patch set only gets marked as disabled on Jenkins, but the actual build keeps on going until its finished.

          What I would like to see is the option to be able to make it stop completely (as if you would manually click the stop build button on Jenkins) when the new patchset is detected

          John V added a comment - Not from what I have seen, the project for the old patch set only gets marked as disabled on Jenkins, but the actual build keeps on going until its finished. What I would like to see is the option to be able to make it stop completely (as if you would manually click the stop build button on Jenkins) when the new patchset is detected

          Gotcha, it's a valid concern then. The new PS build is triggered, anyway, the old job would consume CPU without being able to report any valid feedback, as the PS is obsolete anyway.

          Point taken, thanks for reporting it.

          Luca Domenico Milanesio added a comment - Gotcha, it's a valid concern then. The new PS build is triggered, anyway, the old job would consume CPU without being able to report any valid feedback, as the PS is obsolete anyway. Point taken, thanks for reporting it.

          John V added a comment -

          Forgot to mention that I'm using it in a Multibranch Pipeline together with the git-refs-filter module in Gerrit.

          I did some research and found this file:
          https://github.com/jenkinsci/cloudbees-folder-plugin/blob/master/src/main/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolder.java

          It contains the function updateChildren which I believe is the one handling the disabling of old patch-sets in my case. An alternative to adding something to the gerrit plugin could be if that plugin had the option to also stop jobs when it does the disabling. At least that would be sufficient for my use-case.

          John V added a comment - Forgot to mention that I'm using it in a Multibranch Pipeline together with the git-refs-filter module in Gerrit. I did some research and found this file: https://github.com/jenkinsci/cloudbees-folder-plugin/blob/master/src/main/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolder.java It contains the function updateChildren which I believe is the one handling the disabling of old patch-sets in my case. An alternative to adding something to the gerrit plugin could be if that plugin had the option to also stop jobs when it does the disabling. At least that would be sufficient for my use-case.

          Yes, I did a bit of research and I came to the same conclusion: this is something for the computed-folder-plugin rather than the gerrit-code-review plugin.

          It should be reported and resolved there, as the strategy for stopping the job when it becomes orphan should be done in that class.

          WDYT?

          Luca Domenico Milanesio added a comment - Yes, I did a bit of research and I came to the same conclusion: this is something for the computed-folder-plugin rather than the gerrit-code-review plugin. It should be reported and resolved there, as the strategy for stopping the job when it becomes orphan should be done in that class. WDYT?

          John V added a comment -

          I agree it would make more sense to have it in there, I've created JENKINS-60677.

          John V added a comment - I agree it would make more sense to have it in there, I've created JENKINS-60677 .

            lucamilanesio Luca Domenico Milanesio
            johnv John V
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: