0

From time to time my pipeline fails due to an HTTP request error 401, while trying to get the jenkins file from BitBucket. In this case, instead of crashing with an error message, I'd like to print a friendly error message and possibly send an email.

Is there a way to check for connectivity to the BitBucket server, before trying to run the pipeline? If this is not possible, can I catch this error somehow, and take action on it?

I'm guessing this would have to be something built into Jenkins, or on the Jenkins server, since my jenkins file resides within the repository on the BitBucket server.

An thoughts would be greatly appreciated, as I'm a Jenkins novice.

Tim
  • 101
  • 1
  • 7
  • You can try/catch the error, check [this question](https://stackoverflow.com/questions/43293501/jenkins-pipeline-try-catch-for-particular-stage-and-subsequent-conditional-ste/43303039). Consider to add a snippet of your code to the question. – nandilov May 21 '20 at 21:41
  • @nandilov There's no code that runs. The first step in the pipeline is to access the repository, so that it can read the pipeline file. This step fails, because Jenkins cannot access the repository. – Tim May 29 '20 at 15:42

0 Answers0