Frage

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> 
War es hilfreich?

Lösung

Artifacts are archived regardless of whether the build failed or not. Make sure of the following:

  • You are looking at the actual last build artifacts, not 'Last Successful Build' artifacts.
  • That a build step that produces the artifacts (or copies them into your workspace for archiving) actually runs - chances are it won't run if it is supposed to run after the failure. In that case you need a workaround that depends on your specific situation.

Also take a look at this related question.

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top