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

Pipeline job: Abort older builds which are running

    Details

    • Type: Task
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Incomplete
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      Pipeline version 1.13
    • Similar Issues:

      Description

      Is there a way to make the current build abort older builds (which are running) in a workflow job ?
      Scenario:
      My workflow contains:

      • multiple stages to be run after every SCM changes
      • a stage to be run once every day based on the last build which passed all stages.
        I thought about using waitUntil and stage concurrency: 1

      Build #1 passed all normal stages and waits
      Build #2 passed all stages -> it should abort Build #1 and waits
      Build #3 passed all stages -> it should abort Build #2 and waits ...

      So I want to have just one build (the last one) waiting for the last stage and if waitUntil return true, only the last build should enter the last stage.

      Thank you in advance.
      Any help would be greatly appreciate.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Might be possible already, might not. There is no sample script, and no clear definition of the problem or criteria for a solution. Open-ended questions like this are probably best sent to Stack Overflow rather than the bug tracker, which is intended for clear, concrete fix or enhancement requests.

            Show
            jglick Jesse Glick added a comment - Might be possible already, might not. There is no sample script, and no clear definition of the problem or criteria for a solution. Open-ended questions like this are probably best sent to Stack Overflow rather than the bug tracker, which is intended for clear, concrete fix or enhancement requests.
            Hide
            leon_k Leon Leon added a comment - - edited

            Thank you for the information.
            This issue is related to JENKINS-27039 independently of user inputs.
            The Use Case is to make the last build able to abort older builds in a specific stage (and by doing so, just one build will perform some operations once daily for example).
            In other words, a specific stage should have only the last build which passed all older stages running on it.

            Show
            leon_k Leon Leon added a comment - - edited Thank you for the information. This issue is related to JENKINS-27039 independently of user inputs. The Use Case is to make the last build able to abort older builds in a specific stage (and by doing so, just one build will perform some operations once daily for example). In other words, a specific stage should have only the last build which passed all older stages running on it.
            Hide
            nickbrown Nicholas Brown added a comment -

            A related issue about cancelling builds on branch updates is here: https://issues.jenkins-ci.org/browse/JENKINS-47503

            Show
            nickbrown Nicholas Brown added a comment - A related issue about cancelling builds on branch updates is here:  https://issues.jenkins-ci.org/browse/JENKINS-47503

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                leon_k Leon Leon
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: