Bottom line on top: Is there a way to halt a build immediately when a certain string is encountered in the console output?
We have a maven build that uses the maven target site-deploy (it uploads java doc to a remote server via ssh).
Every once in a blue moon a build fails, and as a result of this failure, the console output file is ~12+ gigs, which files up our drive, which in turn, can cause our Jenkins master to die due to out of diskspace.
The log file gets filled up with the following message repeated over and over again:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is 3d:69:41:8a:ec:d1:4c:d9:75:ef:7d:71:b7:7d:61:d0.
Please contact your system administrator.
Add correct host key in known_hosts to get rid of this message.
Do you want to delete the old key and insert the new key? (yes/no):
We are in the process of fixing the build so that we don't get this error message, but it would really cool if Jenkins can stop/abort the build the moment it encounters this message.
Is there a way to do this?
I don't know any existing solution, but I believe it should be possible to write your own plugin to do so.
You could create a BuildWrapper that decorates the log and searches for your messages, then kill the build when it matches your criteria.
Here's a BuildWrapper that kills a job that has been running too long:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With