Hi,
I'm using https://bitbucket.org/atlassian/trigger-pipeline/src/master/
Once the pipe is running I can find inside the logs the pipeline ID which is running now.
is there a way to get the triggered URL pipeline (the process that is being triggered) as an environment variable or middle script that can use steps or pipes to use this URL and send it to slack or post it into some PR as a comment?
Senario:
Repo A - Sanity testing repo
Repo B - Production product
Once I'm opening a PR inside Repo B, my pipeline is configured to run:
Install, build, deploy demo env, unit testing, and trigger a pipeline on Repo A (Sanity testing)
There is a way to get the URL from the triggered task and for instance add a comment to Repo's B PR the URL that is being running ? instead of digging in the step logs?
Hello @Naor Zveda ,
thanks for reaching out to Bitbucket Cloud Community!
Unfortunately, the pipe atlassian/trigger-pipeline does not currently share the build URL or the build ID with the build container once the pipe completes its execution. That information is currently available only within the pipe's container.
However, since atlassian pipe repositories are public, you have the option to fork the pipe atlassian/trigger-pipeline and do some custom modifications on the pipe's script to cover your use case. Bitbucket Pipelines offer the built-in variables BITBUCKET_PIPE_STORAGE_DIR and BITBUCKET_PIPE_SHARED_STORAGE_DIR that can be used to share state/data between pipes or between the pipe and a step, so you could change the pipe's script to save the build URL to a file inside those directories, and once the pipe is finished you can then get the content of the file in your step's script.
For further details and examples on how to share that information between the pipe and the step you may refer to the following article :
With the build ID in hands, the API endpoint Create a comment in a Pull Request can be used to post this information as a comment in a Pull Request.
Hope that helps! Let me know in case you have any questions.
Thank you, @Naor Zveda !
Patrik S
Hi @Patrik S,
I'd really like to see official support added to the atlassian/trigger-pipeline pipe for retrieving the build number. It would be great not to have to fork and maintain a separate version just to get this one, pretty basic but very powerful feature, included. With the build ID we at least have means of obtaining the log file for the triggered pipeline through REST APIs.
It would be even better to get an officially supported option to leverage the BITBUCKET_PIPE_SHARED_STORAGE_DIR variable, as there are currently no public APIs for downloading pipeline artifacts directly, but I'd already be happy with just the build ID.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Erik,
Please allow me to step in as Patrik is put of office at the moment.
Thank you for sharing feedback. I went ahead and created a feature request for this in our issue tracker:
We also have an existing feature request to provide an API endpoint for artifacts:
Please make sure you add your vote to these feature request (by selecting the link Vote for this issue) to increase the chances of them being implemented. The number of votes and comments helps our product managers better understand the demand for features. You are more than welcome to leave a comment there, and you can also add yourself as a watcher (by selecting the link Start watching this issue) if you'd like to be notified via email on updates.
Implementation of new features is done as per our policy here and any updates will be posted in the feature request.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.