需求:脚本读取文本文件中的构建信息,打印信息,并生成json格式字符串,json字符串用于robot framework调用Jenkins打包用(需要job_name,job_tag及job_type)
脚本如下:
#!/usr/bin/sh
### 输入文件格式如下:
# xxx需求--接口改动 http://svn.xxx.com/xxx/refund_back/branches/3.0.8/
# xxx需求--接口改动 http://svn.xxx.com/xxx/refund_core/branches/3.2.7/
# xxx需求--接口改动 http://svn.xxx.com/xxx/refund_server/branches/2.6.1/
# xxx需求--接口改动 http://svn.xxx.com/xxx/refund_facade/branches/2.0.1/
#各模块名数组
MOD=(refund_domain refund_facade refund_core refund_server refund_back refund_manager_core refund_manager_app)
SPLINE="-------------------------------------------------------------"
#脚本用法,并抓取文件内容到NCSTR变量中
[ $# -lt 1 ] && echo "Usage: `basename $0` + build_info_file" && exit -1 || INFL=$1 && NCSTR=`cat $INFL| grep "http" | sed -e "s#.*\(http.*/\).*#\1#g" -e '/^$/d'