【问题标题】:Hudson/jenkins does not fail on errorsHudson/jenkins 不会因错误而失败
【发布时间】:2012-08-09 12:00:40
【问题描述】:

在我的 Hudson 日志中,我看到错误或失败,但 hudson 说,构建成功。 对吗?

这就是 hudson 所做的(运行 ant 几次)

call f:\runGenericAntBuild.bat %WORKSPACE%  f:\general-build.properties %WORKSPACE%\build\buildProjects.xml deploy %BUILD_NUMBER%  %SVN_REVISION%

call f:\runGenericAntBuild.bat %WORKSPACE%  f:\general-build.properties %WORKSPACE%\build\buildProjects.xml MyJavaProject %BUILD_NUMBER%  %SVN_REVISION%

call f:\runGenericAntBuild.bat %WORKSPACE%  f:\general-build.properties %WORKSPACE%\build\buildProjects.xml buildGrails %BUILD_NUMBER%  %SVN_REVISION%

call f:\runGrailsClean.bat %WORKSPACE%\MyProject

谢谢!

【问题讨论】:

  • 编写单元测试在抛出异常时通过是很常见的——这可能是您在日志中看到的吗?
  • 不,这不“正常”,但您应该提供更多信息(日志内容、作业配置等),否则将很难提供帮助。

标签: build continuous-integration hudson jenkins


【解决方案1】:

您是否有一个批处理步骤,它包含所有四个call 命令?如果是,那就是你的问题。

您的批处理看起来在任何步骤中都没有做任何错误,因此批处理的状态是最后一个命令的状态(您的清理步骤)

要么在 Hudson/Jenkins 中将其拆分为四个独立的构建步骤,要么在批处理脚本中处理错误。

例如

 call f:\runGenericAntBuild.bat your params here || exit /b 1  
 call f:\runGenericAntBuild.bat next params here || exit /b 2
 call f:\runGenericAntBuild.bat third param here || exit /b 3
 call f:\runGrailsClean.bat more param as needed || exit /b 4

这样,批处理将根据失败的步骤退出,错误为 1-4。

【讨论】:

  • 同样,我有时也会使用这个:if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
【解决方案2】:

据我说,Jenkins/Hudson 能够成功完成作业,因为它能够完成分配给他的作业。您可能没有在 buildProjects.xml 文件中设置任何属性,表明构建必须因错误而失败。有一个属性声明构建失败。

【讨论】:

    猜你喜欢
    • 2023-03-17
    • 2022-11-29
    • 2020-04-18
    • 2014-10-29
    • 2011-01-07
    • 1970-01-01
    • 2018-09-05
    • 1970-01-01
    • 2020-08-28
    相关资源
    最近更新 更多