Hi Sarfroz,
To make sure I understand you correctly:
- Your Git server was down
- Jenkins did start a job
- The job tried to check out the code from Git
- That step failed
- You didn't receive a mail for this specific failure (usually, it works)
- You're using Scripted Pipeline, not Declarative Pipeline
Correct?
The problem here is that the mail recipients come from the Jenkinsfile. When Git isn't running, Jenkins can't get the Jenkinsfile and therefore has no chance to figure out where to send mails.
Try to set up monitoring of the Git server outside of Jenkins.
Alternatively, use a freestyle Job triggered by cron which periodically checks that it can connect to the Git server (just execute a git ls or something again a small repo). You can then send a mail from this job when it fails.
Regards,
Aaron Digulla