使用如下方式可以停掉build job:
crumb=`curl -X GET http://<ip>:8080/crumbIssuer/api/json --user jenkins:intel@123|grep -Eo 'crumb":".*",' |grep -Eo ':".*?"' | awk -F '"' '{print $2}'`
curl -X POST -u <username>:<password> -H Jenkins-Crumb:$crumb http://<ip>:8080/job/pipline1/9/stop
如下方式停不掉,猜测属于不同的客户端导致crumb token不同:
crumb=`curl -s http://<ip>:8080/crumbIssuer/api/json|grep -Eo 'crumb":".*",' |grep -Eo ':".*?"' | awk -F '"' '{print $2}'`
curl -X POST -u jenkins:intel@123 -H Jenkins-Crumb:$crumb http://<ip>:8080/job/pipline1/9/stop
Reference: