Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Run pipelines on branch close or pull request merged

Anne Geiersbach January 2, 2020

Is there a way to run the pipelines for running cleanup actions after a pull request is merged? The merge is never done through the UI but with plain git commands and a push to the main branch.

2 answers

0 votes
rgiacalone October 13, 2020

Hello,

I would like to second this question, having pipeline triggered whenever a branch is closed or a PR merged is definately something that bitbucket pipeline should implement.

I am currently evaluating pipelines and workflows and was astonished when I saw how configuring a bitbucket pipeline is easy, but then I realized that triggering offer less features than github for example (as they support on close/on merge event).

Having bitbucket pipeline to trigger on on close/on merge events is a must have for us and may lead us to change our cloud provider for hosting our repositories and CI/CD.

ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2020

Hi @rgiacalone welcome to the Atlassian Community.

Merges are a change of the branch to merge to which is covered by the branch pipeline (which makes total sense to me, your mileage may vary, just saying, there seems to be a misunderstanding what a branch is in a vcs like git.).

Feature requests should go into the atlassian bitbucket cloud jira tracker:

Please do a search there if there is already existing material (or report new) and drop a link here.

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2020

If the merge is local and then distributed to origin via git push, the pipeline you're looking for is in the branches section - it runs when the branch HEAD changes (which it does on push).

Depending on what you would like to find out / to do after merging the branch pipeline can take care of it.

However as the pull request never has been merged through the UI, the only data you can normally work with is the information in the git repository itself as that is shared with Bitbucket and available in the pipeline.

Alternatively you can make use of the Bitbucket API to gather information about open pull requests etc., again looking for git revisions might be a connection point here again.

Not saying there is anything wrong with merging local and pushing to Bitbucket, but I wonder a bit why a pull request is created in the UI if the merge is not done there or more specifically I have problems to give more concrete suggestions as I don't know anything about that cleanup you're talking about in your question.

If it's about closing those pull-requests, then I guess it's about declining the PR via the REST API.

Anne Geiersbach January 6, 2020

We create test environments with our pull requests, and we open pull requests because everything must be reviewed before pushing to the main branch. What I'm trying to do is after a merge tear down the test environment. The test environment is external to atlassian.

Like # people like this
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2020

Can you identify the test environment by the merge commit? E.g. a tag or some other property?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events