We have jenkins pipeline declarative projects that get their pipeline scripts from SCM (git). Notifications are handled in the post block of the script.
Occasionally, the git command (say git checkout) will fail due to some random error (that isn't the problem I'm trying to solve) while getting the script from SCM.
As a result, the pipeline is never checked out and run, and so the notifications do not happen.
I want to have a groovy script (outside of SCM) that will check if the git checkout has failed, and if it has, I send the appropriate notifications.
To that end, I found the Groovy Postbuild plugin. I see a Groovy Script option in the Post-build action select list for a Freestyle Project, however there is no similar Post-build action available in a pipeline project (except in the post block of the script, but that's in the SCM).
Is there a way to run a post-build script that would handle this scenario?