Multiple merges trigger the same pipeline

Deleted user June 9, 2022

So I have a project with multiple repositories. Each time I make a merge in one of those repos a bitbucket pipeline is triggered. This pipeline builds a docker image and then triggers a central pipeline in a separate repo. This central pipeline deploys my application to a server. Because of the multiple repos sometimes I make multiple merges, resulting in multiple pipelines beeing triggered in the central repo. Bitbucket in this case pauses all the pipelines and runs only the first one. Problem is I have to rerun the rest of the pipelines. Can I do that automatically?

 If I can't can I check if a pipeline is already running before triggering another one?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 14, 2022

Hi Spyros and welcome to the community.

I'm afraid that it is not possible to automatically resume paused deployments at the moment.

We have a feature request about this in our issue tracker:

Since you're interested in this feature, I would suggest adding your vote to that feature request (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features.

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get 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.

 

It is possible to check if pipelines builds are running in a certain repo with our API, with a call like the following:

https://api.bitbucket.org/2.0/repositories/WORKSPACE-ID/REPO/pipelines/?sort=-created_on&status=PENDING&status=BUILDING&status=IN_PROGRESS

This endpoint is documented in the link below and I am using filters for the statuses:


Another workaround would be to create a script where you get all paused pipelines in the repo with a call like the following:

https://api.bitbucket.org/2.0/repositories/WORKSPACE-ID/REPO/pipelines/?sort=-created_on&status=PAUSED&status=HALTED

The output will show you the UUID for each paused pipeline.

You can then use an API call like the following to get the UUID of the step of each pipeline:

https://api.bitbucket.org/2.0/repositories/WORKSPACE-ID/REPO/pipelines/{PIPELINE-UUID}/steps/

And then use the following internal API endpoint to start a paused step with method POST:

https://api.bitbucket.org/internal/repositories/WORKSPACE-ID/REPO/pipelines/{PIPELINE-UUID}/steps/{STEP-UUID}/start_step

Please note that this last endpoint is an internal one and as such, it is subject to change. So, even if you decide to use it, for now, I would suggest watching the feature request I shared for updates in an official solution for this.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events