The build should be aborted when the new one begins. So in some cases, a build may be aborted very fast (the pipeline code is not checked out, during the checkout operation). The status of that build is 'failure' not 'aborted' as expected.
There is no post action of multiple branch pipeline. And I didn't find any api to change a build status.
The log is like this:
Started by user Leo
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to https://eos2git.cec.lab.emc.com/xxx/xxx.git
> git config remote.origin.url https://eos2git.cec.lab.emc.com/xxx/xxx.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
using GIT_ASKPASS to set credentials PASSWORD IS TOKEN
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at java.lang.UNIXProcess.waitFor(UNIXProcess.java:395)
at hudson.Proc$LocalProc.join(Proc.java:324)
at hudson.Proc.joinWithTimeout(Proc.java:170)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1992)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:351)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:373)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:564)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:95)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:295)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
How can make aborted pipeline build always have 'aborted' result status. If the pipeline scripts start processing, then abort the build, the result will be 'aborted'. But when the build is checking out code, the pipeline scripts is not started, then abort the build, the build result will be 'failure'.