jenkins stop job by using crumbissuer

 

Can be used as follows stopped 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

A way that can not afford to stop, guess belonging to different clients lead to different 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:

https://segmentfault.com/a/1190000010738617

 

Guess you like

Origin www.cnblogs.com/i-shu/p/11493405.html