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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.