【jenkins报“”Build step ‘Execute Windows batch command‘ marked build as failure“”问题解决】
·
报错如下:
Building in workspace C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\销售订单双签-焦炭
[销售订单双签-焦炭] $ cmd /c call C:\WINDOWS\TEMP\jenkins16265249724103305523.bat
C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\销售订单双签-焦炭>D:
D:\>cd D:\接口自动化\销售订单双签\焦炭
D:\接口自动化\销售订单双签\焦炭>newman run D:\接口自动化\销售订单双签\焦炭\销售订单-焦炭-双签.postman_collection.json -e D:\接口自动化\销售订单双签\脚本环境.postman_environment.json -d D:\接口自动化\销售订单双签\销售.csv -r htmlextra --reporter-htmlextra-export D:/接口自动化/销售订单双签/焦炭/测试报告/report.html
Using htmlextra version 1.22.3
Created the htmlextra report.
Build step 'Execute Windows batch command' marked build as failure
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level D:/接口自动化/销售订单双签/焦炭/测试报告 to C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\jobs\销售订单双签-焦炭\htmlreports\HTML_20Report
Finished: FAILURE
原因:
jenkins执行命令,会把命令生成一个批处理文件执行,而newman命令对于批处理来说是外部命令,所以要加call表示调用。而jenkens执行window命令,若退出代码不为0,则jenkins会将构件标记为失败,所以需要加上exit 0 表示执行完成退出
解决方法:
构建命令在newman前面加上call,最后加上exit 0,如图:

更多推荐
所有评论(0)