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

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

Ashok Kumar Srinivas April 4, 2016

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
Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2016

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

Ashok Kumar Srinivas April 4, 2016

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.

JamieA
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.
April 5, 2016

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.

Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2016

@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)?

Ashok Kumar Srinivas April 5, 2016

@@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.

 

Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2016

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..

JamieA
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.
April 5, 2016

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events