Is it safe to delete files in xml-data/build-dir/
Asked by Jayasree Tadanki:

Hi

I see we have folders/files from 2/23/17 in xml-data/build/dir

Is it OK to clean them up?

Thanks in advance

Jayasree


Answers:
author: Steffen Opel _Utoolity_
body: Probably not, though this depends on your retention needs for the build and deployment artifacts etc. - please see section */xml-data/builds/* within [Bamboo server home directory](https://confluence.atlassian.com/bamboo/locating-important-directories-and-files-289277247.html#Locatingimportantdirectoriesandfiles-homeBambooserverhomedirectory) (also applies to [Bamboo agent home directory](https://confluence.atlassian.com/bamboo/locating-important-directories-and-files-289277247.html#Locatingimportantdirectoriesandfiles-agenthomeBambooagenthomedirectory)) for details:
> This is known as the *Build Directory* . This is where Bamboo stores build results (note that they will be deleted as described in [Configuring global expiry](https://confluence.atlassian.com/bamboo/configuring-global-expiry-289277253.html)). Its contents can be backed up as per [Exporting data for backup](https://confluence.atlassian.com/bamboo/exporting-data-for-backup-289277255.html).
>
> **`xml-data/builds/`*JOB_KEY*`/results`**   
> Contains the build results for all the builds belonging to the *JOB_KEY* plan. Each build result is an individual XML file. Do not edit these files or the corresponding information in the database may become corrupt.
>
> **`xml-data/builds/`*JOB_KEY*`/download-data`**   
> Contains the logs for each build belonging to the *JOB_KEY* plan.

As hinted upon in the first paragraph, rather than manually cleaning up those build directories, the recommended way to deal with old files is [Configuring global expiry](https://confluence.atlassian.com/bamboo/configuring-global-expiry-289277253.html) according to your business needs:
> Global expiry allows you to manage the timing for when build and deployment artifacts should be deleted from your Bamboo system.
>
> You may want to consider doing this for the following reasons:
>
> * Build and deployment artifacts can be large, and so consume storage on your system. Your system may run out of disk space if artifacts no longer in active use are retained indefinitely.
> * Large numbers of builds and deployments clutter the Bamboo user interface, and may reduce performance, making it slower to work with Bamboo.
>
> See this [Atlassian blog post](http://blogs.atlassian.com/2012/06/bamboo-build-artifact-log-expiry/) for a discussion of using build expiry and labels.
>
> \[...\]

comments: author: Jayasree Tadanki
body: Thanks Steffen, sometimes when I run my plan it fails right away showing it could not clean up xml-data\>build-dir\>jobname\>lib

So I log in to server and clean up the lib folder in that folder and rerun the script. It works after the clean up. We also clone plans to create new ones. Is it better to create new plan rather than cloning?

Thanks again for the info.

J


author: Steffen Opel _Utoolity_
body: Cloning plans is completely fine, and so is manually cleaning up (part of) the build folder in exceptional circumstances like you are doing there for 'lib', insofar most of the files are temporary build results anyway - I just wanted to make sure you are aware that the main build artifacts and logs are also stored there and *could* be accidentally deleted in principle, hence the recommendation to resort to the built-in automatic expiry mechanism by default.  

Cheers,  
Steffen


author: Jayasree Tadanki
body: Sounds good, Thanks you very much for clarifying it

J


author: Jayasree Tadanki
body: Steffen

I have one more question, not sure I can post it here and in different session. Our selenium scripts are not working on Bamboo with FF57 version. Is there a fix available to make them work?

Thx in advance :)


author: Steffen Opel _Utoolity_
body: [@Jayasree Tadanki](/t5/user/viewprofilepage/user-id/886094) - I highly recommend to ask a separate question for each separate topic: This provides the best chance for a qualified answer, because everyone monitors the title and tags of new (!) questions to check whether one has the specific know how to provide a valuable answer (in other words, comments to 'old' questions like this one are rarely noticed by anyone but the few initial thread participants).  

For the same reason, please also 'accept' my answer as solution via the checkmark on the left side so that it doesn't show up as unanswered anymore, thereby keeping others and myself focused on and motivated to assist with new questions :)  

Cheers!


author: Jayasree Tadanki
body: Thanks a lot. I clicked the check box :)


author: Torbj?rn S?rli
body: > also applies to [Bamboo agent home directory](https://confluence.atlassian.com/bamboo/locating-important-directories-and-files-289277247.html#Locatingimportantdirectoriesandfiles-agenthomeBambooagenthomedirectory)

Is this accurate? As far as I can tell, when "Clean working directory after each build" is enabled for all the jobs in a plan, then **`xml-data/build-dir/`*JOB_KEY*`/`**on remote agents will be completely empty after the build has completed.

Seems like it would be safe to delete most folders in build-dir on remote agents, just keeping **_git-repositories-cache** and **repositoryData**.