小编典典

如何在Jenkins中获取最新成功构建的build_id?

jenkins

通常,为了获得最新成功构建的工件,我wget对以下URL进行了处理:

http://jenkins.com/job/job_name/lastSuccessfulBuild/artifact/artifact1/jenkins.txt

有没有办法,我可以继续wget下去lastSuccessfulBuild并在build_id下面得到一个像?

build_id=`wget http://jenkins.p2pcredit.local/job/job_name/lastSuccessfulBuild`

阅读 327

收藏
2020-07-25

共1个答案

小编典典

是的,有一种方法,它非常简单:

$ build_id=`wget -qO- jenkins_url/job/job_name/lastSuccessfulBuild/buildNumber`
$ echo $build_id
131 # that's my build number
2020-07-25