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

multiple aborts exit declarative post always step

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 2.73.3 on Linux (Centos 7).
      All plugins up to date.

      Declarative pipeline runs through its stages. User clicks abort/cancel red button, pipeline drops into post step as expected. Post has an always block. User then clicks abort again (they are impatient), post is executing always, most likely sh commands, and is then terminated. The 2nd abort should be ignored and the post always should be allowed to complete? There is only one block in the post (always). Post always should be allowed to do cleanup (or is there away to turn off the abort signal once it enters the post always?).

          [JENKINS-51586] multiple aborts exit declarative post always step

          Alastair Munro created issue -
          Alastair Munro made changes -
          Environment New: Jenkins 2.73.3 on Linux (Centos 7).
          All plugins up to date.
          Oleg Nenashev made changes -
          Component/s New: pipeline [ 21692 ]
          Component/s New: pipeline-model-definition-plugin [ 21706 ]
          Component/s Original: core [ 15593 ]

          Alastair Munro added a comment - - edited

          A bit of googling shows there is a soft kill versus a hard kill. So ideally clicking the red box would generate a soft kill, while a hard kill can be done via listing the console output and clicking on `Click here to forcibly terminate running steps`? If anyone has any tips or things I can try out, please let me know.

          If you wish to reproduce, here is a sample pipeline:

          pipeline {
            agent { label 'master' }
          
            stages {
          
              stage('Stage1') {
                steps {
                  script {
                    println "In stage1"
                    sleep(60)
                  }
                }
              }
          
              stage('Stage2') {
                steps {
                  script {
                    println "In stage1"
                    sleep(60)
                  }
                }
              }
          
            }
          
            post {
              always {
                script {
                  def c = 0
                  println "Testing post stage is interupted"
                  while (c < 3) {
                    println "Interated loop ${c}."
                    sleep(60)
                    c++
                  }
                }
              }
            }
          }
          
          

          Alastair Munro added a comment - - edited A bit of googling shows there is a soft kill versus a hard kill. So ideally clicking the red box would generate a soft kill, while a hard kill can be done via listing the console output and clicking on `Click here to forcibly terminate running steps`? If anyone has any tips or things I can try out, please let me know. If you wish to reproduce, here is a sample pipeline: pipeline { agent { label 'master' } stages { stage( 'Stage1' ) { steps { script { println "In stage1" sleep(60) } } } stage( 'Stage2' ) { steps { script { println "In stage1" sleep(60) } } } } post { always { script { def c = 0 println "Testing post stage is interupted" while (c < 3) { println "Interated loop ${c}." sleep(60) c++ } } } } }
          jang hyemi (Inactive) made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Component/s Original: pipeline [ 21692 ]
          Andrew Bayer made changes -
          Assignee New: Andrew Bayer [ abayer ]
          Andrew Bayer made changes -
          Component/s New: workflow-job-plugin [ 21716 ]
          Component/s Original: pipeline-model-definition-plugin [ 21706 ]
          Andrew Bayer made changes -
          Assignee Original: Andrew Bayer [ abayer ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]

            Unassigned Unassigned
            amunro Alastair Munro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: