Getting Last promoted build number

47 views
Skip to first unread message

zippo7061

unread,
Apr 28, 2015, 12:37:50 PM4/28/15
to jenkins...@googlegroups.com, bgav...@apartments.com
I was trying the get the last successful build that was promoted (promotion plugin) into a specific environment out of Jenkins, but not sure how.  Gain, not looking for Build Number, but for the build# that was promoted.  Ran into some success using the xml/api, but this quickly ended as it doesn't seem i have a way of extracting the most recent in the build.  

http://JENKINS/job/APPLICATION/promotion/process/QA_ENVIRONMENT/api/xml?depth=1&xpath=/*/build[2]/target/number was promising, but can't set the most recent buld number.  The xml format seems to change and would have to not do xpath read all and then sort by date somehow.  Not good to do.

The end result is to put the # on a wiki page that has tons of other information, so linking/iframes not really a good thing, would like to just get the result from a GET and display it on a page.

Melissa Palmer

unread,
Apr 29, 2015, 3:02:19 PM4/29/15
to jenkins...@googlegroups.com, bgav...@apartments.com
Hi Zippo, did you manage to solve this? I'm needing to get the previous promoted build number too. Thanks Melissa

Hau Vong

unread,
Apr 29, 2015, 3:18:31 PM4/29/15
to jenkins...@googlegroups.com, bgav...@apartments.com
you can use environment variable promoted_number to get last promoted build number

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d3b614ee-6454-4fab-bbeb-df3f8d07d712%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

zippo7061

unread,
Apr 29, 2015, 3:21:02 PM4/29/15
to jenkins...@googlegroups.com, bgav...@apartments.com
Thank you, but can you please provide an example on how you would get to that env variable from a url GET.

corneil....@gmail.com

unread,
Apr 29, 2015, 4:18:02 PM4/29/15
to jenkins...@googlegroups.com
I usually add a shell step that writes the promoted build number to a file that can be accessed via a url.
The file will get lost if it remains in the workspace so it will be best to add an archive step after shell step.
You should then use a url to the archived content.

Reply all
Reply to author
Forward
0 new messages