简体   繁体   中英

jenkins plugin to fail build based on console output

Is there a plugin to fail a build if a pattern occurs on the console output?

For example:

Build Action - success
Build Action - success
Build Action - error_pattern
Build Action - success

Let's assume that the Jenkins build process does not fail the build on error_pattern, I need to have an external fail trigger of some sort.

EDIT

Looking for a solution to fail the build during, not a post build task.

You should try the Post Build Task plugin. You can search for a pattern and then launch a script.

edit: There is also Text finder plugin , looks better for your problem

As an ugly workaround I do the following: in the build script redirect all the output to some resulting .log file, then you can grep through this file in the background the way you like (personally I do the freezing check additionally - calculate the checksum and compare with previous, if the same - start counting for timeout until threshold), etc...

Disadvantage is the output goes to some file instead of Jenkins console, but I guess you can do both using tee (I don't care, because my goal is to archive the log anyways and send it via email, - so I just gzip my resulting .log file and attach it as an artifact to the build record + to the email).

Advantage is you have full control on what happens in the build output and can interrupt the build using your own return code / message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM