jenkinsci/gerrit-trigger-plugin — pull request #12 by jhansche (2012-02-29 07:08:14+00:00)
Title: JENKINS-12881: Allow reading custom build message from a workspace file, in case of non-success

The ticket [JENKINS-12881](https://issues.jenkins-ci.org/browse/JENKINS-12881) describes the use case, and links to the discussion in Confluence. The 2nd commit message in this pull request lists a use case and defines what success/failure look like.

--

I didn't approach it exactly the same way that Robert suggested in the Confluence discussion. But I could see this expanding in the future to support plugins, such that *any* post-build step can modify the failure message. E.g., if the xUnit plugin looked for the GerritTrigger plugin, it could set the failure message to be "x / y tests failed". Or a Gerrit-Trigger-builtin post-build step could be selected that looks for the error-message text file. Violations plugin could indicate that "the change introduces more than `X` new violations", or the Clover plugin could indicate "the change drops code coverage below `Y%`".

Or another builtin could exist that looks to see which build or post-build plugin was the one that triggered the non-SUCCESS build step. For example, the build console output records this::

Build step 'Execute shell' marked build as failure

and that would be a possible failure message. Or even the last "n" lines of the console output.

I like the idea of allowing that to be pluggable, such that any plugin would be able to broadcast a human-readable representation of why it failed, and that could be sucked in to the non-success message.