How can I remove branch builds?

Before I took control of my server, someone created dozens of plan branch builds. I do not see a way to remove them, just disable. I'd like to remove these to reduce clutter, can I locate and remove these on the file system to prevent them from showing up for the plan? I'm not using automated branching in bamboo. I'd like to avoid removing and recreating the plan.

4 answers

1 accepted

This widget could not be displayed.

I created a script which generated a series of curl commands. I had to delete 40,000 of them, so my case was more interesting.... but it led me to know how to do so programatically. you increment the buildkey by 1 for each.. so i did a for loop and used the iteration number ( EASNYTEST-TESTPRODUCT${i} )

The "&save=Confirm" part is important too :)

curl -k -u username:password ! -X GET 'https://bambooserver:port/chain/admin/deleteChain!doDelete.action?buildKey=EASNYTEST-TESTPRODUCT4&returnUrl=%2Fbrowse%2FEASNYTEST-TESTPRODUCT%2FeditConfig&save=Confirm'

This widget could not be displayed.

After working on that for a while, I found that while viewing the branch, the Actions menu has a Delete Branch option. Wish I had seen that. But I did learn some cool things from the answer above, Thanks!

Thanks. It is so intuitive...

This widget could not be displayed.

We encountered a similar issue when Bamboo somehow created 5,000 duplicate branches plans across 6 unique plans.

Needless to say, deleting them by hand was not feasible. One of our engineers wrote a jquery script that when executed on the "configure branch plans" screen of bamboo would programatically invoke the delete URL for each branch that match the given name.

jQuery("a:contains('<branchNamePartial>')").map(function (a) {
  var a = this;
  return a.href.substring(a.href.indexOf('browse/') + 7, a.href.lastIndexOf('/'));
}).each(function (i, pk) {
  setTimeout(function () {
    jQuery.ajax({
      url: ' http://<bamboo.url>/chain/admin/deleteChain!doDelete.action?save=Confirm&atl_token=&atl_token_source=js&returnUrl=/about.action&buildKey=' + pk,
      dataType: 'text'
    })
  }, 1);
});

This was against bamboo 5.4.2. Obviously this selector should be tested before running the delete function against each result. It was just run from the chrome JS console.

There is now some XSRF protection that prevents this from functioning. Here's a revised snippet that also refines the branch selector better as well: {code} jQuery("#config-sidebar ul.branches a:contains('<substring for branches to delete>')").map(function (a) { var a = this; return a.href.substring(a.href.indexOf('browse/') + 7, a.href.lastIndexOf('/')); }).each(function (i, pk) { setTimeout(function () { jQuery.ajax({ url: ' http://<bamboo.url>/chain/admin/deleteChain!doDelete.action?save=Confirm&atl_token=&atl_token_source=js&returnUrl=/about.action&buildKey='; + pk, dataType: 'text', type: 'POST', }) }, 1); {code}

This widget could not be displayed.

NOTE: This is Shane Poage's comment from one of the answers, moving it to an answer so it's easier to read.

 

There is now some XSRF protection that prevents this from functioning. Here's a revised snippet that also refines the branch selector better as well:

jQuery("#config-sidebar ul.branches a:contains('&lt;substring for branches to delete&gt;')").map(function(a) {
        var a = this;
        return a.href.substring(a.href.indexOf('browse/') + 7, a.href.lastIndexOf('/'));
    }).each(function(i, pk) {
            setTimeout(function() {
                jQuery.ajax({
                    url: ' http://&lt;bamboo.url&gt;/chain/admin/deleteChain!doDelete.action?save=Confirm&amp;atl_token=&amp;atl_token_source=js&amp;returnUrl=/about.action&amp;buildKey='; + pk,
                    dataType: 'text',
                    type: 'POST',
                })
            }, 1);

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 6 hours ago in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

38 views 0 8
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