-
Bug
-
Resolution: Duplicate
-
Major
-
Host machine: Fedora release 25 (4.11.12-200)
(reproduced by docker image jenkins/jenkins 2.60.3 aca6340878dd)
Jenkins ver. 2.60.3
Plugins (all up to date vesions):
bouncycastle-api bouncycastle API Plugin 2.16.2
cloudbees-folder Folders Plugin 6.1.2
structs Structs Plugin 1.10
junit JUnit Plugin 1.21
antisamy-markup-formatter OWASP Markup Formatter Plugin 1.5
pam-auth PAM Authentication plugin 1.3
windows-slaves Windows Slaves Plugin 1.3.1
display-url-api Display URL API 2.0
mailer Mailer Plugin 1.20
ldap LDAP Plugin 1.16
workflow-step-api Pipeline: Step API 2.12
scm-api SCM API Plugin 2.2.1
workflow-api Pipeline: API 2.20
pipeline-milestone-step Pipeline: Milestone Step 1.3.1
jquery-detached JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin 1.2.1
jackson2-api Jackson 2 API Plugin 2.7.3
ace-editor JavaScript GUI Lib: ACE Editor bundle plugin 1.1
workflow-scm-step Pipeline: SCM Step 2.6
script-security Script Security Plugin 1.33
workflow-support Pipeline: Supporting APIs 2.14
workflow-cps Pipeline: Groovy 2.39
pipeline-input-step Pipeline: Input Step 2.8
pipeline-stage-step Pipeline: Stage Step 2.2
workflow-job Pipeline: Job 2.12.2
pipeline-graph-analysis Pipeline Graph Analysis Plugin 1.5
pipeline-rest-api Pipeline: REST API Plugin 2.9
handlebars JavaScript GUI Lib: Handlebars bundle plugin 1.1.1
momentjs JavaScript GUI Lib: Moment.js bundle plugin 1.1.1
pipeline-stage-view Pipeline: Stage View Plugin 2.9
pipeline-build-step Pipeline: Build Step 2.5.1
credentials Credentials Plugin 2.1.14
ssh-credentials SSH Credentials Plugin 1.13
plain-credentials Plain Credentials Plugin 1.4
credentials-binding Credentials Binding Plugin 1.13
pipeline-model-api Pipeline: Model API 1.1.9
pipeline-model-extensions Pipeline: Declarative Extension Points API 1.1.9
git-client Git client plugin 2.5.0
git-server GIT server Plugin 1.7
workflow-cps-global-lib Pipeline: Shared Groovy Libraries 2.8
branch-api Branch API Plugin 2.0.11
workflow-multibranch Pipeline: Multibranch 2.16
icon-shim Icon Shim Plugin 2.0.3
authentication-tokens Authentication Tokens API Plugin 1.3
docker-commons Docker Commons Plugin 1.8
durable-task Durable Task Plugin 1.14
workflow-durable-task-step Pipeline: Nodes and Processes 2.15
docker-workflow Docker Pipeline 1.12
pipeline-stage-tags-metadata Pipeline: Stage Tags Metadata 1.1.9
pipeline-model-declarative-agent Pipeline: Declarative Agent API 1.1.1
workflow-basic-steps Pipeline: Basic Steps 2.6
pipeline-model-definition Pipeline: Model Definition 1.1.9
workflow-aggregator Pipeline 2.5
token-macro Token Macro Plugin 2.2
external-monitor-job External Monitor Job Type Plugin 1.7
matrix-auth Matrix Authorization Strategy Plugin 1.7
matrix-project Matrix Project Plugin 1.11
build-timeout build timeout plugin 1.18
timestamper Timestamper 1.8.8
resource-disposer Resource Disposer Plugin 0.7
ws-cleanup Workspace Cleanup Plugin 0.34
ant Ant Plugin 1.7
gradle Gradle Plugin 1.27.1
github-api GitHub API Plugin 1.86
git Git plugin 3.5.1
github GitHub plugin 1.28.0
github-branch-source GitHub Branch Source Plugin 2.2.3
pipeline-github-lib Pipeline: GitHub Groovy Libraries 1.0
mapdb-api MapDB API Plugin 1.0.9.0
subversion Subversion Plug-in 2.9
ssh-slaves SSH Slaves plugin 1.21
email-ext Email Extension Plugin 2.58
Host machine: Fedora release 25 (4.11.12-200) (reproduced by docker image jenkins/jenkins 2.60.3 aca6340878dd) Jenkins ver. 2.60.3 Plugins (all up to date vesions): bouncycastle-api bouncycastle API Plugin 2.16.2 cloudbees-folder Folders Plugin 6.1.2 structs Structs Plugin 1.10 junit JUnit Plugin 1.21 antisamy-markup-formatter OWASP Markup Formatter Plugin 1.5 pam-auth PAM Authentication plugin 1.3 windows-slaves Windows Slaves Plugin 1.3.1 display-url-api Display URL API 2.0 mailer Mailer Plugin 1.20 ldap LDAP Plugin 1.16 workflow-step-api Pipeline: Step API 2.12 scm-api SCM API Plugin 2.2.1 workflow-api Pipeline: API 2.20 pipeline-milestone-step Pipeline: Milestone Step 1.3.1 jquery-detached JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin 1.2.1 jackson2-api Jackson 2 API Plugin 2.7.3 ace-editor JavaScript GUI Lib: ACE Editor bundle plugin 1.1 workflow-scm-step Pipeline: SCM Step 2.6 script-security Script Security Plugin 1.33 workflow-support Pipeline: Supporting APIs 2.14 workflow-cps Pipeline: Groovy 2.39 pipeline-input-step Pipeline: Input Step 2.8 pipeline-stage-step Pipeline: Stage Step 2.2 workflow-job Pipeline: Job 2.12.2 pipeline-graph-analysis Pipeline Graph Analysis Plugin 1.5 pipeline-rest-api Pipeline: REST API Plugin 2.9 handlebars JavaScript GUI Lib: Handlebars bundle plugin 1.1.1 momentjs JavaScript GUI Lib: Moment.js bundle plugin 1.1.1 pipeline-stage-view Pipeline: Stage View Plugin 2.9 pipeline-build-step Pipeline: Build Step 2.5.1 credentials Credentials Plugin 2.1.14 ssh-credentials SSH Credentials Plugin 1.13 plain-credentials Plain Credentials Plugin 1.4 credentials-binding Credentials Binding Plugin 1.13 pipeline-model-api Pipeline: Model API 1.1.9 pipeline-model-extensions Pipeline: Declarative Extension Points API 1.1.9 git-client Git client plugin 2.5.0 git-server GIT server Plugin 1.7 workflow-cps-global-lib Pipeline: Shared Groovy Libraries 2.8 branch-api Branch API Plugin 2.0.11 workflow-multibranch Pipeline: Multibranch 2.16 icon-shim Icon Shim Plugin 2.0.3 authentication-tokens Authentication Tokens API Plugin 1.3 docker-commons Docker Commons Plugin 1.8 durable-task Durable Task Plugin 1.14 workflow-durable-task-step Pipeline: Nodes and Processes 2.15 docker-workflow Docker Pipeline 1.12 pipeline-stage-tags-metadata Pipeline: Stage Tags Metadata 1.1.9 pipeline-model-declarative-agent Pipeline: Declarative Agent API 1.1.1 workflow-basic-steps Pipeline: Basic Steps 2.6 pipeline-model-definition Pipeline: Model Definition 1.1.9 workflow-aggregator Pipeline 2.5 token-macro Token Macro Plugin 2.2 external-monitor-job External Monitor Job Type Plugin 1.7 matrix-auth Matrix Authorization Strategy Plugin 1.7 matrix-project Matrix Project Plugin 1.11 build-timeout build timeout plugin 1.18 timestamper Timestamper 1.8.8 resource-disposer Resource Disposer Plugin 0.7 ws-cleanup Workspace Cleanup Plugin 0.34 ant Ant Plugin 1.7 gradle Gradle Plugin 1.27.1 github-api GitHub API Plugin 1.86 git Git plugin 3.5.1 github GitHub plugin 1.28.0 github-branch-source GitHub Branch Source Plugin 2.2.3 pipeline-github-lib Pipeline: GitHub Groovy Libraries 1.0 mapdb-api MapDB API Plugin 1.0.9.0 subversion Subversion Plug-in 2.9 ssh-slaves SSH Slaves plugin 1.21 email-ext Email Extension Plugin 2.58
Issue
If I abort pipeline during shell step running (probably it can be reproduced with other step types) in Post section currentBuild.result value is FAILURE, failure action runs, but finally build is ABORTED
There was Issue https://issues.jenkins-ci.org/browse/JENKINS-43339], but seems like it not fully fixed issue at the moment.
Expected behavior
In case of abort currentBuild.result is ABORTED in Post section, and aborted action trigger instead failure
Steps to reproduce
1. Install Jenkins 2.60.3. I have done it wich docker
docker run --name abort-test -p 127.0.0.1:8080:8080 jenkins/jenkins:2.60.3
2. Install suggested plugins in wizzard
3. create new pipeline http://localhost:8080/view/all/newJob
pipeline {
agent any
stages {
stage('sleep dsl'){
steps{
sleep 15
}
}
stage('sleep sh'){
steps{
sh "sleep 15"
}
}
}
post {
always{
echo "Build status ${currentBuild.result}"
}
changed {
echo "changed block"
}
success {
echo "success block"
}
unstable {
echo "unstable block"
}
failure {
echo "failure block"
}
aborted {
echo "aborted block"
}
}
}
4. Run it
4.1 firstly just take it to finish. It is of course success
[Pipeline] node
Running on master in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (sleep dsl)
[Pipeline] sleep
Sleeping for 15 sec
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sleep sh)
[Pipeline] sh
[test] Running shell script
+ sleep 15
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Build status null
[Pipeline] echo
success block
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
4.2 Then run again and abort in first stage (push red cross
[Pipeline] node
Running on master in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (sleep dsl)
[Pipeline] sleep
Sleeping for 15 sec
Aborted by Andrii Danyleiko
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sleep sh)
Stage 'sleep sh' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Build status ABORTED
[Pipeline] echo
changed block
[Pipeline] echo
aborted block
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: ABORTED
It is Aborted as expected
4.3 Abort in second stage.
[Pipeline] node
Running on master in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (sleep dsl)
[Pipeline] sleep
Sleeping for 15 sec
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sleep sh)
[Pipeline] sh
[test] Running shell script
+ sleep 15
Aborted by Andrii Danyleiko
Sending interrupt signal to process
Terminated
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Build status FAILURE
[Pipeline] echo
changed block
[Pipeline] echo
failure block
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 143
Finished: ABORTED
why?
4.4. Pause in second stage (with "Pause/resume"). Wait at least 15s (to be sure that shell finished). Then push red cross and again "Pause/resume" (If you not wait or wait after abort before resume it will be the same as 4.3 case)
Started by user Andrii Danyleiko
Replayed #9
[Pipeline] node
Running on master in /var/jenkins_home/workspace/test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (sleep dsl)
[Pipeline] sleep
Sleeping for 15 sec
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sleep sh)
[Pipeline] sh
[test] Running shell script
+ sleep 15
Pausing
Aborted by Andrii Danyleiko
Resuming
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Build status ABORTED
[Pipeline] echo
aborted block
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: ABORTED
- duplicates
-
JENKINS-43339 `currentBuild.result` is not set to `ABORTED` when the build was aborted
- Closed