Reputation: 2677
I want to Archive the artifacts of my program, but when the build failes he doesn't save the artifacts. Why is this?
Because I only want to read the artifact when the job failed!
Thanks for your response!
--
Always when the job fails, I didn't get the artifact. I test it in very small jobs:
Empty batch file + artifact a file, Result: Job Succesfull, Artifact: succesfull
Exit 1 in batch file + artifact a file, Result: Job fails, Artifact: didn't do anything
config.xml file of the job:
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<customWorkspace>C:\test\</customWorkspace>
<builders>
<hudson.tasks.BatchFile>
<command>exit 1</command>
</hudson.tasks.BatchFile>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>tomcat\logs\tomcat.log</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
</publishers>
<buildWrappers/>
</project>
Upvotes: 4
Views: 14618
Reputation: 595
In "Archive the Artifact" step, click on Advanced button. Uncheck "Archive artifacts only if build is successful" So even if your unit tests failed, you will have the artifacts archived.
Upvotes: 2
Reputation: 16605
Artifacts are archived regardless of whether the build failed or not. Make sure of the following:
Also take a look at this related question.
Upvotes: 5