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

How to prevent Pipeline build when a new branch is created off develop branch?

Deleted user May 1, 2018

Hi

So in other words, if there is no difference (no new commit) between newly created branch and 'develop' branch which is our main branch, I don't want Pipeline build get initiated.

Is there any configuration or can I do this with a script perhaps?

Thanks

 

1 answer

0 votes
Alexey Matveev
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.
May 1, 2018

If you want to limit pipelines only to the develop branch, you should properly configure bitbucket-pipelines.yml. You can find an example here:

https://community.atlassian.com/t5/Bitbucket-questions/Limit-pipelines-to-a-specific-branch/qaq-p/389704

You can read more info here:

https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html

Deleted user May 1, 2018

No I don't want to limit the build to a branch. When I create a branch off develop, the new branch kicks off the build automatically while no developer has made any change to the new branch. The new branch is basically the same as develop branch. I want this specific one to be skipped. However as developers make changes to the new branch, the build should starts as normal.

As I mentioned, I want to skip a build whenever there is no change against the branch compare to the target branch

Alexey Matveev
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.
May 2, 2018

Ah, I see. I do not have such a problem, because I make a new branch in my IDE and then when I am done, I push my new branch to Bitbucket. That is why pipeline works only on the modified branch for me.

Deleted user May 2, 2018

I can stop the build with a few GIT command to check if the current head commit is the same as develop or not but I was wondering if Pipeline has a more elegant way :)

Thanks

Alexey Matveev
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.
May 2, 2018

If you have a solution, kindly post it as an answer and accept your answer. It will help other users.

Deleted user May 3, 2018

Well... I've been trying to come up with a solution... I tried to use git diff command:

 

git diff remotes/origin/develop..${CURR_BRANCH_NAME}

 

but I get error as if there is no develop branch... didn't have time to investigate more but the thing is, I was thinking even if I get this working, all I can do is returning error so the build fails... which isn't good... I like the build to be green or any other state than failure.

Because this isn't really a failure. Also I guess if a build fails, all the caches get invalidated

So I leave this open to see if anyone answers with a better solution

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events