- You must authenticate to your own bamboo server in order to use this. Specifically, the page you must have open with your favorite developer tools will look like
http://<bamboo-url>/chain/admin/config/configureBranches.action?buildKey=<build-key>
- Once you're on this page, you can copy and paste this script into the chrome developer tools, replacing <bamboo-url> with the main URL of your bamboo instance.
- Make sure to change the 'develop-' to a string you want to match in bulk, because if you don't have any branches that contain develop- this won't do anything
- This only works on active branches. If you want to delete disabled branches instead, change 'develop-' to '.branches > .disabled a'
Last active
May 25, 2016 18:09
-
-
Save lowenthal-jason/5bd4fbc3ea3b2ffee4c25ff391ff0582 to your computer and use it in GitHub Desktop.
Bamboo Bulk Deletion of Branches Using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Look up all of the branches that contain with 'develop-' | |
jQuery("a:contains('develop-')").map(function (a) { | |
var a = this; | |
// Trim off all of the excess URL cruft to get back just the plan key | |
return a.href.substring(a.href.indexOf('browse/') + 7, a.href.lastIndexOf('/')); | |
}).each(function (i, planKey) { | |
// For each plan key, use the bamboo action chain to delete it using a POST through jQuery ajax. | |
setTimeout(function () { | |
jQuery.ajax({ | |
url: 'http://<bamboo-url>/chain/admin/deleteChain!doDelete.action', | |
method: 'POST', | |
data: { | |
buildKey: planKey, | |
save: 'Confirm' | |
}, | |
dataType: 'text' | |
}) | |
}, 1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment