jenkins job构建后汇总结果到同一个文本文档中去

jenkins 构建后,执行下shell脚本,把结果汇总到同一个文件中,这样多个job构建后的结果可以在一个文件中展示

result_all_dir="/app/jenkins_result/"
result_json_dir="/app/jenkins_result/"$JOB_NAME
result_all="/app/jenkins_result/result_all.txt";
result_json="/app/jenkins_result/"$JOB_NAME"/result_json.txt";

#执行前先清空上次执行结果
rm -rf $result_all_dir; if [ -d "$result_all_dir" ]; then echo "exist"; else mkdir $result_all_dir; fi if [ -d "$result_json_dir" ]; then echo "exist"; else mkdir $result_json_dir; fi echo $result_all; echo $result_json; rm -rf $result_all; rm -rf $result_json; curl http://xxx.xxx:8888/jenkins/view/%E6%AF%8F%E6%97%A5%E6%9E%84%E5%BB%BA/job/$JOB_NAME/$BUILD_NUMBER/api/json >> $result_json; echo $BUILD_NUMBER"|"$JOB_NAME"|"$SVN_URL"|"$(sed -n 's/.*\"result\":\"\(.*\)\"/\1\",/p' $result_json | awk -F"\"" '{print $1}')"|"$(date "+%Y-%m-%d %H:%M:%S")>> $result_all;

 

posted @ 2017-02-28 13:57  testway  阅读(2749)  评论(0编辑  收藏  举报