当前位置:网站首页>[Jenkins] shell script calls Jenkins API interface
[Jenkins] shell script calls Jenkins API interface
2022-06-22 10:38:00 【bulabula2022】
# Use list for What the loop is going to run job name
for variable in job1 job2 job3
do
# Get the next build number
job_number=`curl --silent http://ip:port/job/$variable/api/json --user account:password |jq --raw-output '.nextBuildNumber'`
# perform job
curl -n -X POST http://ip:port/job/$variable/buildWithParameters --user --user account:password --data cp_branch='git Branch '
# Inquire about job The state can execute in cycles at most 5 Time
for i in `seq 1 5`
do
# Query interval ,60s, Start the next job Maximum interval 5 minute
sleep 60
# Get current job Running results
##job_result=$(curl --silent http://ip:port/job/$variable/lastBuild/api/json --user account:password |jq --raw-output '.result')
job_result=`curl --silent http://ip:port/job/$variable/$job_number/api/json --user account:password |jq --raw-output '.result'`
echo "================= The first $i Detection current job name :${variable},job Number :$job_number,job Running state : $job_result ====================================="
if [[ $job_result = "SUCCESS" ]];then
echo "=================job:$variable Build complete , Run next ==================="
break
elif [[ $job_result = "FAILURE" ]] || [[ $job_result = "ABORTED" ]];then
echo "=================job:$variable Build failed , Run next ==================="
break
elif [[ $i = 5 ]] && [[ $job_result = "null" ]];then
echo "=================job:$variable Build more than 5 minute , Not waiting. , Run the next... Directly job ==================="
else [[ $job_result = "null" ]]
echo "job_$variable In the building ......"
fi
done
done
边栏推荐
- TCP异常连接
- scrapy. Transfer of meta parameter data of request()
- 【毕业季·进击的技术er】青春不散场
- 【jmeter】shell脚本自动执行jmeter
- QT compile the Internet of things management platform 36- communication protocol
- Bluetooth, WiFi, ZigBee, Lora, Nb lot, call signal, network signal 4G
- 字节二面:Redis主节点的Key已过期,但从节点依然读到过期数据是为什么?怎么解决?
- IPO配置指南
- Investment transaction management
- PHP开发的网站,如何实现批量打印快递单的功能?
猜你喜欢

Cobalt strike from starting to Imprisonment (3)

社区文章|MOSN 构建 Subset 优化思路分享

一条TCP连接时占用内存空间多少?

IPO Configuration Guide

Catch up with this big guy

外贸专题:外贸邮件营销模板

Start from the principle of MVC and knock on an MVC framework to bring you the pleasure of being a great God

Zero‐Copy API

The future of Dao: an organization primitive for building Web3

Kirin software and Geer software focus on the development of network data security
随机推荐
超简单的C语言贪吃蛇 不闪屏 双缓冲
Cobalt Strike 从入门到入狱(三)
Quickly master asp Net authentication framework identity - login and logout
iNFTnews | 观点:市场降温或是让NFT应用走向台前的机会
Catch up with this big guy
HMS Core新闻行业解决方案:让技术加上人文的温度
Zuckerberg's latest VR prototype is coming. It is necessary to confuse virtual reality with reality
It is said that the price of the iPhone 14 will rise; TikTok US user data is transferred to Oracle, and bytes cannot be accessed; Seatunnel 2.1.2 releases geek headlines
Byte 2: why is the key of the redis master node expired, but the expired data is still read from the secondary node? How to solve it?
Software project management 8.3 Agile project quality activities
Pule frog VR typhoon escape experience VR disaster self rescue simulation system VR popular science knowledge equipment
[this tool, combined with JMeter, will increase your work efficiency by at least 80%, which is highly recommended]
【jenkins】shell脚本调jenkins api接口
软件项目管理 8.3.敏捷项目质量活动
字节二面:Redis主节点的Key已过期,但从节点依然读到过期数据是为什么?怎么解决?
外贸专题:外贸邮件营销模板
PowerDesigner tip 2 trigger template
jg_使用easyexcel读取excel_20220619
Encryption market plummeted, Seth triggered a new round of concern
数据库课程虚拟教研室负责人杜小勇:立足国产数据库重大需求,探索课程体系建设新模式