@EdwinTang
2016-01-27T22:16:59.000000Z
字数 806
阅读 1955
JENKINS
JOB
CI
调度
在实际系統中,CI工作中常常由多个包的构建或部署构成,顺序构建,或独立构建都面临效率低的问题。
A.其中一個包更新
包间有依赖
包间无依赖
B.多個包都需要更新
1.选择参数构建
2.灵活使用字符串参数
3.借用shell划分字符串
4.借用curl命令调用其它JOB
#!/bin/bash
echo ${SELECT} |grep -q "0"
if [ $? -eq 0 ]; then
curl -X POST http://XXX:XXX/jenkins/job/JOB_NAME/build
fi
sleep 2
min=1
while(($min==1))
do
echo `curl --silent http://XXX:XXX/jenkins/job/JOB_NAME/lastBuild/api/json` |grep -q '"result":"SUCCESS"'
if [ $? -eq 0 ]; then
break
else
sleep 5
fi
done
for elem in ${SELECT}
do
case $elem in
1) curl -X POST http://XXX:XXX/jenkins/job/DDT_SIT_WS_BUILD/build
;;
2) curl -X POST http://XXX:XXX/jenkins/job/DDT_SIT_NGINX_BUILD/build
;;
3) curl -X POST http://XXX:XXX/jenkins/job/DDT_SIT_MAIN_BUILD/build
;;
4) curl -X POST http://XXX:XXX/jenkins/job/DDT_SIT_MANAGER_BUILD/build
;;
5) curl -X POST http://XXX:XXX/jenkins/job/DDT_SIT_SYNC_BUILD/build
;;
esac
done