I use Jenkins to run some integration tests on a web appilcation (using cucumber, capybara and selenium)
Everytime a test fails, a screenshot, the HTML source and a video of the process is saved.
the path structure looks like this:
results/output/<test_name>/<files>
I use the archive artifacts feature of Jenkins to provide the files (pattern: results/output/*/*). It works great.
However as soon as a build succeeds, there are no screenshots/videos etc… and the build fails because Jenkins cannot find the files for the pattern.
Is there a way to tell Jenkins to succeed without having the files present?
I don’t want to do a dirty hack which involves creating an empty folder structure like result/output/success/hooray.txt.
I ran into a similar issue on a couple of our projects. There are two different ways we have resolved it (on two different builds).
1) Added a command to the build steps that creates a bogus temporary file if no files already existed.
In this case, it was meant to collect an output.pdf file that would be generated if the tests failed. I added a build step where if that file did not exist we created a “missing.pdf” file. Then what I collect as artifacts is ‘*.pdf’ from the given directory. This seems to work out pretty well.
2) On another build we needed to collect a set of files using a glob.
What we did here was made it so the build step always creates a single empty file in the destination area. That way the glob always matches something.
Those are the best solutions we have found so far. If you find something better I would love to hear about it.