I'm trying to get the latest pipeline build status for a slack webhook. In order to do that, I need to get the latest pipeline ID from the API.
I tried doing this in a bitbucket-pipelines.yml file (for the current running pipeline to then send a slack notification) using the $BITBUCKET_PIPELINE_UUID default variable but it keeps returning null. Maybe it returns null because the pipeline isnt finished yet?
Hey Rinesa,
I have tested this on my own Bitbucket Cloud repository by echoing the $BITBUCKET_PIPELINE_UUID during the build process (ie within the script portion of the build) and this returns the correct UUID without issue.
The Pipeline UUID will only return a value once the agent process has finished executing (ie once the initial build setup begins) so it must be gathered during this time.
The UUID can also be gathered from the browser if you know the Pipeline number (which is found in the URL of the pipeline):
https://bitbucket.org/!api/2.0/repositories/workspaceID/reposlug/pipelines/pipelineNo/steps/
Hope this helps.
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.