How to determine if the branch was removed/deleted and recreated in the GIT using Stash ?

We have a confusing situation, a branch seemed like removed in GIT repository and subsequently the bamboo  deleted one of its branch plans on Bamboo after 14 days of time as we have enabled delete branches option.

The development team claims that they did not remove any branch, how could bamboo delete its plan ? Branch isn't active.  We tried reflog, but it did seem like a much help. I've tried to check the audit log on Stash to learn if there was any removal done on branch. But we could not locate or find any trace.

Can you please help us on this ? Thank you in advance.

 

1 answer

0 votes

Hi Ashok, 

Bitbucket Server does record all push activity (but it does not make it available in the UI yet), so you could query the database to see how and when the branch has been updated by pushes. The following should return all pushes that updated the branch master in the repository yourrepo:

select a.created_timestamp, u.name as username, repo.name as repo_name, ref.*                                                                                                                                                                                                                                           from sta_activity a, sta_repo_activity ra, repository repo, sta_repo_push_ref ref, sta_normal_user u 
where a.id=ra.activity_id and a.user_id=u.user_id and ra.repository_id=repo.id and ref.activity_id=a.id and ref.ref_id='refs/heads/master' and repo.name='yourrepo';

Note that a deleted branch should show up as a row with to_hash set to 0000000000000000000000000000000000000000

Hi Michael,

Thank you for your answer.  Again today we have encountered the similar problem. Bamboo deleted the branch plan for the branch which is yet active in GIT & Stash.

Note : We have not enabled daily clean up on the plan's configuration. We have only enabled branch configuration "This plan branch will be removed after 14 days of being deleted, or after 14 days of inactivity".

From Audit Log:

03:00, 5 Apr SYSTEM  Plan deleted: CaLM - Calypso Custom - release-r11.5 (CALM-CLPSCSTMSNAP55)

Plan is removed by the system and we had to re-create the plan today. I wonder if the same repeats tonight for no reason.  Any suggestion from you on this to fix would be highly appreciated. 

Please do let us know if you sense or feel that we had done some sort of misconfiguration.

Thank you in advance.

Something similar has been happening to me lately. I created a branch, branch plan was automatically created. I merged the branch. Some time later I created a branch with the same name, now bamboo deletes the branch after some period of time, seems to be every day.

@Jamie Echlin [Adaptavist] That sounds like an issue with Bamboo not correctly detecting the branch being recreated - does https://jira.atlassian.com/browse/BAM-16341 match your problem?

@Ashok Kumar Srinivas has the branch in question been deleted at any point, in which case it would be the same problem as Jamie is seeing? If not, I assume that branch is still active (in that changes are still being pushed to it in Stash)?

@@Michael Heemskerk, I spoke to the development team about a few mins ago to double check on this branch removal.  They say it was never removed from the source repository.

 

Have you verified when the branch in question last changed in Stash? If it was more than 14 days ago, the branch plan would have been deleted by Bamboo, exactly as configured. If not, something is wrong..

@Michael Heemskerk - yep, that looks like the culprit, thanks.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

682 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot