by XDK
30. January 2014 11:37
Explanation:
A command line tool that only removes the attachments. It does not touch the test runs, which contain the pass/fail data. So, running Test Attachment Cleaner will not impact the record of the test runs.
You need to Test Attachment Cleaner if you:
- Do manual test runs and want to delete attachments without deleting the test runs
- Do automated test runs and want to delete attachment for builds which have been deleted already, but the build definition’s retention policy was not set to delete “test results” (because this is turned off by default)
You do not need the Test Attachment Cleaner if you:
- Have automated test runs triggered by a build, and you have configured the build definition’s retention policy to delete “test results” (which is not set by default)
- Delete the Test Runs manually (as this deletes the attachments)
SQL Query to get the attachment type associated with the team project.
Select projects.ProjectName, SUBSTRING(attachments.filename,
len(attachments.filename)-CHARINDEX('.',REVERSE(attachments.filename))+2,999) as Extension, sum(f.compressedlength)/1024/1024 as SizeInMB
From tbl_Attachment as attachments
INNER JOIN tbl_File as f on attachments.TfsFileId=f.fileid
INNER JOIN tbl_TestRun as tr on attachments.TestRunId = tr.TestRunId
INNER JOIN tbl_Project as projects on tr.ProjectId = projects.ProjectId
Group by projects.ProjectName, SUBSTRING(attachments.filename,len(attachments.filename)-CHARINDEX('.',REVERSE(attachments.filename))+2,999)
Order by sum(f.compressedlength) desc
Download Attachment Cleaner
Command to preview the attachments before delete
tcmpt attachmentcleanup /collection
:TfsUrl
/teamproject
:TeamProjectName
/settingsfile
:SettingsFile
/outputfile
:<Output dir>
/teamproject
.log
/mode
:
preview
Command to delete the attachments
tcmpt attachmentcleanup /collection
:TfsUrl
/teamproject
:TeamProjectName
/settingsfile
:SettingsFile
/outputfile:<Output dir>
/teamproject
.log
Sample settingsfile
<DeletionCriteria>
<TestRun/>
<Attachment>
<SizeInMB GreaterThan="50"/>
</Attachment>
<LinkedBugs>
<Excludestate="New"/>
<Excludestate="Committed"/>
<Excludestate="Approved"/>
</LinkedBugs>
</DeletionCriteria>
by XDK
20. December 2013 07:17
Todeleteorphanworkspaces.sql (2.93 kb)
To delete orphan workspaces.sql (2.93 kb)
Explanation:
Deleting a team project through tfsdeleteproject command will result making the associated workspaces and shelvesets as orphan records in TFS collection database. The collection database size may not reduce as expected even after team project delete.
tfsdeleteproject /force /q /excludewss /collection:"<Collection Name>" "<Project Name>"
Solution:
The attached script finds and deletes the workspaces\shelvesets that only have workspace\shelvesets mappings for projects that no longer exist and delete them.
Please backup the collection database before you execute the script.
This script require TFS 2012 update 2 or newer
To delete orphan workspaces.sql (2.93 kb)
To delete orphan shelvesets.sql (2.58 kb)
by XDK
21. December 2008 13:38
[No text]