Jenkins Build does not work when artifacts are not there

I use Jenkins to run some integration tests in a web application (using cucumber, capybara and selenium)

Each time the test fails, a screenshot is saved, the source of the HTML and the video of the process.

the structure of the path is as follows:

results/output/<test_name>/<files> 

I use the Jenkins archive artifact function to provide files (pattern: results/output/*/* ). It works great.

However, as soon as the assembly completes successfully, there are no screenshots / videos, etc ... and the assembly fails because Jenkins cannot find the files for the template.

Is there a way to tell Jenkins to succeed without having files?

I do not want to make a dirty hack that involves creating an empty folder structure, such as result / output / success / hooray.txt.

+6
source share
2 answers

I encountered a similar problem in several of our projects. We can solve two different methods (on two different lines).

1) A build steps command has been added that creates a dummy temporary file if the files did not already exist.

In this case, he had to collect the output.pdf file, which would be generated if the tests failed. I added a build step, where if this file was not there, we created the file "missing.pdf". Then what I collect as artifacts is "* .pdf" from this directory. This seems to work very well.

2) On another assembly, we needed to build a set of files using glob.

We made it so that the build step always creates a single empty file in the destination area. So glob always matches something.

These are the best solutions that we have found so far. If you find something better, I'd love to hear about it.

+4
source

There is an open problem for this: https://issues.jenkins-ci.org/browse/JENKINS-10502

The behavior is controlled by the hudson.tasks.ArtifactArchiver.warnOnEmpty system property, as described in https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties

+13
source

Source: https://habr.com/ru/post/904391/


All Articles