我想存档我的程序的工件,但是当构建失败时,他不保存工件。为什么是这样?

因为我只想在作业失败时读取神器!

感谢您的答复!

——

总是当工作失败时,我没有得到工件。我在非常小的工作中测试它:

空批处理文件+神器一个文件,
结果:工作成功,
神器:成功

在批处理文件中退出 1 + artifact a 文件,
结果:作业失败,
神器:什么都没做

作业的 config.xml 文件:

<?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>

最佳答案

无论构建是否失败,工件都会被存档。请确保以下几点:

  • 您正在查看实际的最后构建工件,而不是“上次成功构建”工件。
  • 生成工件(或将它们复制到您的工作区以进行存档)的构建步骤实际运行 - 如果它应该在失败后运行,则它很可能不会运行。在这种情况下,您需要一个取决于您的具体情况的解决方法。

  • 也看看 at this related question

    关于tomcat - Jenkins 在构建失败时保存工件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10928928/

    10-11 18:50
    查看更多