在jenkins 的shell里执行newman run 订货.postman_colletion.json -e 订货环境变量.postman_environment.json -r html --reporter-html-export report/$name$time.html
当脚本量多的时候构建打印在控制台提示Build step 'Execute shell' marked build as failure Finished:FAILURE,当脚本少的时候是成功的
在jenkins的shell 里的第一行加入
#!/bin/sh 好像是清缓存
然后就变成下面控制台不打印太多信息,但是还是会报错
网上找的在脚本前面加入,#!/bin/sh 脚本最后加入 exit 0
shell内容
#! /bin/sh
str =$params 接jenkins传进来的json数据格式的 {"name":"小红","time":"20231230"}
na=`echo $str | jq .name`
ti=`echo $str | jq .time`
name=`echo $na | sed 's/\"//g'` 去除双引号
time=`echo $ti | sed '/\"//g'`
cd /root/.jenkins/workspace/newman 这是jenkins工作空间的路径,也是git上传和拉取脚本的位置
newman run 订货.postman_collection.json -e 订货环境变量.postman_environment.json -r html --report-html-export html/$name$time.html 在html目录下生成html报告名字和日期是传进来的
exit 0