使用Jenkins API促进构建 [英] Promote build with Jenkins API
本文介绍了使用Jenkins API促进构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于Jenkins构建作业具有不同的推广工作(即,将构建物推广到不同的环境),那么如何使用Jenkins API触发特定构建的特定推广工作?
解决方案
我知道这是一个老话题,但这只是为了帮助社区. p>
使用 CURL 的Shell解决方案:
user_name="jenkins_user"
user_token="token"
promotion_name="Test_Promote"
jenkins_url="http://build-server.com"
JOB_NAME="job_name"
JOB_NO="job-no"
url="--silent -u $user_name:$user_token $jenkins_url/job/$JOB_NAME/$JOB_NO/promotion/forcePromotion?name=$promotion_name"
curl $url
如何生成jenkins用户令牌: https://jenkins.io/blog/2018/07/02/new-api-token-system/
Given a Jenkins build job with different promotion jobs (i.e., that promote builds to different environments), how can one trigger a specific promotion job for a specific build using the Jenkins API?
解决方案
I know this is an old thread, but just to help the community.
Shell Solution using CURL:
user_name="jenkins_user"
user_token="token"
promotion_name="Test_Promote"
jenkins_url="http://build-server.com"
JOB_NAME="job_name"
JOB_NO="job-no"
url="--silent -u $user_name:$user_token $jenkins_url/job/$JOB_NAME/$JOB_NO/promotion/forcePromotion?name=$promotion_name"
curl $url
How to generate jenkins user token: https://jenkins.io/blog/2018/07/02/new-api-token-system/
这篇关于使用Jenkins API促进构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文