Details
-
Bug
-
Resolution: Fixed
-
Low
-
7.0.2
-
None
-
1
-
Severity 2 - Major
-
Description
Issue Summary
If deletion service is called using immutable representation of a plan branch, the stages of the master plan are marked for deletion, which is incorrect.
Important: This problem only happens if plan branches are removed programmatically, by a plugin. Users using built-in Bamboo functionality are not affected.
Steps to Reproduce
- Install plugin that calls deletionService.deletePlan(ImmutablePlan plan). Argument must not be of type ImmutablePlanBranchImpl (must be really immutable branch). (For instance: https://github.com/mibexsoftware/plan-branch-terminator)
- Do whatever is required for a plugin to be triggered (in case of plan-branch-terminator, it's removing branch from Bitbucket Server)
- Wait for the deletion service to run.
Expected Results
Branch is removed. Master plan and other branches are intact.
Actual Results
Message like this can be seen in the logs and afterwards stages and jobs of the master plan are removed
2020-04-06 09:03:23,076 INFO [DelayedDeletionThread] [PlanHibernateDao] 4 jobs have incorrectly set deletion flags, updating them
Workaround
- disable the plugin until the bug is fixed
- modify the plugin it so that it doesn't call deletionsService using 'ImmutablePlanBranch'. Use mutable object instead, like this:
PlanManager planManager; //not cachedPlanManager! //...... private void deleteMutableRepresentationOfBranch(final ImmutableChainBranch chainBranch) { final Plan mutableBranch = planManager.getPlanById(chainBranch.getId()); if (mutableBranch != null) { try { deletionService.deletePlan(mutableBranch); } catch (final RuntimeException e) { log.warn("Unable to delete chain branch " + chainBranch.getPlanKey(), e); } } }
Attachments
Issue Links
- mentioned in
-
Page Loading...