Li Jian (TWer in China office) took few days to write ruby code to clean the artifacts repository of Go automatically.
It is ruby code on google code (svn checkout http://cruisetools.googlecode.com/svn/trunk/ ). Anyone can check out to use.
You can run it to clean the artifacts under the artifacts folder. If some files/folders need to be kept, just put the relative path of files/folders in the file 'foldersToBeKept.txt' (One path in each line)
Then run the script 'rake dirname=/var/lib/cruise-server/logs/pipelines time=1w', it will delete all folders which are generated 1 week ago except for the folders in the kept list.
the param 'dirname' is the absolute path for the repository,
the param 'time' could be 1w, 2w, .... (means to delete the folders n weeks ago)
1m, 2m, .... (means to delete the folders n months ago)
2009-05-01 ... (meams to delete the folders before 2009-05-01)
you can run cron task to clean it. And our approach is following.
We setup a pipeline called 'cleanArtifacts' to clean the folder which is generated 1 week ago except for the ones in the list of folderToBeKept.txt.
And the job in this pipeline will be run by the agent which is running on the same box of Cruise server.
We only want to keep the important artifacts and get rid of others. So we setup a subversion repository say 'http://xx.xx.xx.xx:8080/svn/artifactsmanagement'. And only one file 'foldersToBeKept.txt' in the repository.
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.