I have a Jenkins pipeline that all stages complete and report as Success but the overall build is marked as Failed. This occurs every time a build is run. Builds are run from start to finish without any "continue from last stage". The jenkins version and plugins are all updated to current.
If I look at each stage it says "Success" in the hover-over (see screenshot).
What am I missing here?
EDIT 1: Adding blue ocean screenshot:

The end of the pipeline log file:
[Pipeline] }
[Pipeline] // withEnv
Post stage
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] mail
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: FAILURE
EDIT 2: Added post section
Here is the end of the pipeline statement:
post {
failure {
mail to: "$MAIL_NOTIFY",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
EDIT 3: Removed post failure
If I remove the "post { failure { mail ... } }" section then the build completes successfully. So the question is now... How do I fix this section to work properly?

