API to find the gocd buildNumber

56 views
Skip to first unread message

Piyush

unread,
Nov 4, 2021, 8:11:39 PM11/4/21
to go-cd
Hi,

We have one requirement where in we need to trigger the gocd pipelines remotely. I have gone through the gocd apis and i have found sufficient info on "how to trigger the pipeline"

However, i need to know one critical piece of iinformation

1. Once the build pipeline is scheduled - how do i get the build number (as we say in jenkins world) or instance number.  I mean we can alway go through pipeline history api (find the latest pipeline instance ---> trigger the build remotely ---> find the latest pipeline instance.. and you have your pipeline instance)
However, this approach will not work in the case where some one has triggered manual builds as well. In that case both the builds (remotely triggered and manual triggered) builds will be scheduled and i do not know how to get the pipeline instance corresponding to the remote build.

Any suggestions or help?

PS:- i was thinking to check the timestamp and compare but thats a workaround .

Thanks
Piyush

cal...@vertify.com

unread,
Nov 5, 2021, 11:24:07 AM11/5/21
to go-cd
A more determinate way would be to use a dedicated userid to trigger the pipeline, then you could you find that userid in the stages.approved_by member of the pipeline instance.

- Craig
Reply all
Reply to author
Forward
0 new messages