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

Pipeline job: Abort older builds which are running

    • Icon: Task Task
    • Resolution: Incomplete
    • Icon: Critical Critical
    • pipeline
    • None
    • Pipeline version 1.13

      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.

          [JENKINS-32997] Pipeline job: Abort older builds which are running

          Leon Leon created issue -
          Leon Leon made changes -
          Description Original: Is there a function to make the current build abort older builds during the workflow:
          Scenario:
          My workflow contains multiple steps to be runned after every SCM changes, and a step to be runned 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

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

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



          New: Is there a way to make the current build abort older builds during the workflow:
          Scenario:
          My workflow contains multiple stages to be run after every SCM changes, and 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          Leon Leon made changes -
          Description Original: Is there a way to make the current build abort older builds during the workflow:
          Scenario:
          My workflow contains multiple stages to be run after every SCM changes, and 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          New: 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, and 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          Leon Leon made changes -
          Description Original: 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, and 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          New: 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          Leon Leon made changes -
          Description Original: 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 enter the waitUntil
          Build #2 passed all stages -> it should abort Build #1
          Build #3 passed all stages -> it should abort Build #2

          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.



          New: 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 wait ...

          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.



          Leon Leon made changes -
          Description Original: 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 wait ...

          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.



          New: 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.



          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.

          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.
          Jesse Glick made changes -
          Resolution New: Incomplete [ 4 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          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.

          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.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 168821 ] New: JNJira + In-Review [ 198472 ]

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

              Created:
              Updated:
              Resolved: