How do I manually clear the workspace for a job across multiple agents?

Sometimes the workspace for a job can get irrevocably corrupted (eg. the workspace is kept between jobs, and some cached data is incorrect because one of the executions was buggy). In these circumstances, the easiest way to resolve the problem is to delete the workspace and re-create it from scratch when the job next runs.

However, there is no obvious way to do this with Bamboo. This question is along the same lines, but ultimately did not find a satisfactory solution (especially when you are using multiple agents). To summarise, the options are:

  1. Temporarily modify the job definition to clean the workspace (eg. "Force clean build" in the source checkout) and run the job.
  2. Have a clean task permanently defined in your job definition, which is enabled with a variable. When you need to clean, then run the job with the cusotm variable set.
  3. Go through all the workspaces for all your agents on all your machines and manually delete the job's workspace from the file system.

Any of these optionas are "good enough" workarounds if you only have 1 agent. However, the first 2 don't work reliably when you have multiple agents (the workspace for only 1 of the agents will have been cleaned), and the final one doesn't scale well.

Are there any other approaches, or should I create a feature request?

2 answers

Indeed, it would be great to be able to do this as administrative action. I often find myself deleting build folders on the master and several agents to correct a script that has gone wrong or some weird build issue that is only fixed by cleaning the lot.

Hi Gary,

One more workaround that you can consider is to check the "Clean working directory after each build" option on the Miscellanious tab for each job configuration page. I think the main request here is to clean the workspaces of different plans before even running any builds, correct? If yes, you can go ahead and raise a new feature request on https://jira.atlassian.com.

Armen

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,561 views 0 6
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