So I have a multi stage pipeline build.
One of those stages run pytest - a subsequent stage picks up the test result.
As it stands because there are test failures pytest returns a non zero exit code causing jenkins to stop at that step and mark the build failed (red)
If I don't return the none zero exit code the build is marked unstable as there are failing tests.
However, the build is not stopped at that point.
Now what I want to do is to be able to stop the build at that point so I don't call any subsequent stages after a test failure... but not have the build marked failed. I do however want the post stage to still run and then have the build marked unstable (as there was not an error but only a test failure).
Ideally I'd like a pipeline command "stopBuild(unstable)" or something like that.
The "fail build on test failure" is nice because it stops the build - i.e. does not run any subsequent stages. I want this behaviour when I detect a test has failed as well.
Default behaviour when a test failure is detected is to continue running the build.
I don't really want to have to add another stage to stop subsequent stages from running... and I certainly don't want to have to put a filter in any subsequent stage.