views:

253

answers:

2

Hi,

I'd like to publish certain files for each build regardless of success/failure. In my case I want to publish a report generated from a JUnit RunListener implementation we've implemented, however I would also find it useful to publish additional log files, and any other specific files I am interested in.

I know TeamCity does this out of the box. Is it possible with Hudson? The DocLinks plugin and the "Archive the artifacts" checkbox only seem to work for successful builds.

Thanks in advance

A: 

I thought so far, that Hudson marks a job as unstable instead of failed when running the junit tests.

However, If you don't want to create your own plugin, you might use a workaround. The basic idea is to hide from Hudson the initial failure and do whatever needs to be done before telling Hudson that there is a problem.

There are different approaches.

  1. Always hide errors from Hudson, the job will never fail, however, the report will always be published. The disadvantage is, that you need to monitor the jobs/reports since Hudson will not tell you that there is a problem.

  2. capture the error outside of Hudson, than do your publish outside of Hudson, and than tell Hudson that there was an error and let Hudson do the rest.

Peter Schuetze
Thanks for the answer, Peter. Looks like nothing out of the box without the fixes you have suggested. I'll have a look further into the options you suggested and at worst case just have the report in the last build's target directory and tell people to scp it themselves.
Matt Byrne
You can always link directly to the latest build and the latest build report without publishing the build number e.g. http://<server>/job/<jobname>/lastBuild/testReport
Peter Schuetze
+2  A: 

The "archive the artifacts" feature kicks in even for failed builds. If it doesn't, I consider that a serious bug. Which version of Hudson are you using?

Kohsuke Kawaguchi
Thanks very much - my oversight. I thought I had read somewhere that it didn't do this for failed builds. I've enabled this option and it's working exactly as I want. Thanks!
Matt Byrne

related questions