Skip to end of metadata
Go to start of metadata

Plugin Information

View TextFinder on the plugin site for more information.

This plugin lets you search keywords in the files you specified and use that to downgrade a "successful" build to be unstable or a failure.This is handy when you have some tools in your build chain that don't use the exit code properly.

The search is always performed, even on builds which returned a non-zero exit status, but the reclassification only applies to builds which returned an overall exit status of zero.

Change Log

Version 1.10 (Jan 31, 2014)
  • No longer blocking concurrent builds. (JENKINS-17507)
  • Cleaner config UI using help buttons
  • Japanese translation
Version 1.9 (Feb 13, 2011)
  • Update link in help
Version 1.8 (Feb 6, 2010)
  • Update code for more recent Hudson
Version 1.7 (May 4, 2009)
Version 1.6 (Nov 6, 2008)
  • Modified to work with all job types, including Maven2 jobs.
Version 1.5
  • Added "Unstable if found" configuration option.  Use this option to set build unstable instead of failing the build.  Default is off (previous behavior).

11 Comments

  1. Does this support multi-line regex searches?

    For instance, if the console had:

    [hibernatetool] 1. task: hbm2ddl (Generates database schema)
    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    alter table account_statement_address add constraint FK612CAF92BE9E69AE foreign key (account_id) references account
    alter table account_statement_address add constraint FK612CAF9212A012FF foreign key (party_geographic_address_id) references party_geographic_address
    alter table statement_copy_addr add constraint FKBBB86BABBE9E69AE foreign key (account_id) references account
    alter table statement_copy_addr add constraint FKBBB86BAB12A012FF foreign key (party_geographic_address_id) references party_geographic_address
    [INFO] Executed tasks
    

    and I provided a regex of:

    log4j:WARN Please initialize the log4j system properly\.\n(.\|\n){1,}\[INFO\] Executed tasks
    

    to get the output of hbm2dll.

    1. I've taken 8 years to think about this (wink) , but I'm guessing not:

      My case:

      Target Text: 

       ==  Identical                            1845117 
       <>  Different                            1212    
      >>   Only in Source                       52742   
        << Only in Target                       1215    
       >x  Conflict Source Records              0       
       x<  Conflict Target Records              0

      Regex:

       ==  Identical                            [1-9][0-9][0-9][0-9][0-9][0-9][0-9] \n <>  Different                            [1-7]?[0-9]?[0-9]?[0-9]?

      This has no match, but I've tried in Java Regex testers online and 'The Regex Coach', and they all find a match.

      But trying one line definitely works:

       ==  Identical                            [1-9][0-9][0-9][0-9][0-9][0-9][0-9] 

       

       

  2. Unknown User (bazthemail@gmail.com)

    Would you please provide an example on how to search multiple strings from the console log? For example, search for three keywords: "^Error:", "FATAL ERROR", and "ERRORE:". I tried and without succeed.

  3. Unknown User (gunner_1980)

    Does this have the ability to search for multiple regular expressions and return different results based off of them?  From the looks of it you can only pass/fail or choose unstable based off of the searched.  For example I would like to be able to fail the build if it finds one regular expression or show a build as unstable if it finds another.  Right now it looks like it is all or nothing but it would be really nice to be able to specify a regex that would trigger a build fail and another regex that would trigger a build unstable.  The fail would of course need to override any unstable regex's that are found.

  4. Unknown User (fndaway)

    I just added the plug to hudson 1.386

    And check the following: "Hudson Text Finder"  "Also search the console output"  and"Unstable if found"

    and I added as regex "BUILD_FAILED"  w/o quotes. My test script it echoes  "BUILD_FAILED"  and I see the message in the console output,

    However the jobs still is failed (red).  I tried adding "BUILD_FAILED"  with quotes and even ".*" w/o quotes and still fails.

    Please help what I'm doing wrong.

    <3

    1. Unknown User (fndaway)

      FYI:  It seems that this plug in to work the exit code from the script must be 0.

      My test.sh exited with 10, however I still want to set it as unstable when "BUILD_FAILED" on console.

      Seems to me like even if the exit code is not zero the but the expression is found the plug-in should still work.

      <3

  5. If a searched file does not exist, then this is always considered a failure: but this should be configurable.

    For example, I wish to detect IF there are files with a specific name that contain the WARNING string, but if there are no such files all should be considered ok.

    I only found the workaround to always generate an empty file during the build.

    Thanks

  6. The documentation for this plugin could be improved a lot - in particular, it would be very helpful if it said

    "This plugin can be used to downgrade a successful build to "unstable" or "failure" if a regular expression matches in a set of files.
    For example, it can be used to search for the string "failure" in a set of log files."

    I have raised https://issues.jenkins-ci.org/browse/JENKINS-12512 to propose this more formally.

    1. The current description on this page seems to cover the points you make.

      As designed, though, the capabilities seem to be limited though:

      • The ability to set either unstable or failed, depending upon what strings are found (Geoff's suggestion)
      • The ability to promote a failed build (in the case of extenuating circumstances for things that crash predictably)
      • The ability to downgrade a build to aborted

      I would like to mark builds aborted in certain circumstances -- for instance when the necessary pre-conditions to perform a successful build have not been met.  When we run our script, the only outcomes (without manual intervention) are failed, succeeded, or unstable, but we already have meaningful scenarios for these.  We could just keep waiting, but then that means it would be a while for people to understand what is going on.

  7. Is it possbile to specify multiple files in "Files to Search". If so, how is this achieved.

  8. Jenkins Text Finder functionality is working but it is taking longer to read the console output. 

    I have no idea about the reason behind it. Could you suggest any.

    13:19:58 Checking console output
    14:18:48 Email was triggered for: Always

    Here's the the expression that I am using:

    (?i)unstable*|.*(?i)completed. Result was FAILURE.*|.*(?i)[INFO] BUILD FAILURE*