tfsbuildazure-devopstfvcvnext

TFVC: Deleting workspace fails during vnext build


we are running TVFC with "Azure DevOps Server" 2019 Update1.

At the end of our vnext build, we want to delete the workspace. We do this using tf.exe. But we have to specify the workspace owner, because the account that runs the build (meaning the account that is configured for the build service on the build agent) is different from the account used to create the workspace.

The workspace owner is "Project Collection Build Service (DefaultCollection)". So as command to delete the workspace we use e.g.:

tf.exe workspace /delete /noprompt /collection:http://tfs.siplaceworld.net:8080/tfs/DefaultCollection/ ws_1749_167;Project Collection Build Service (DefaultCollection)

This works most of the time. Sporadically we get an error message saying:

TF14061: The workspace ws_1749_167;Project Collection Build Service (DefaultCollection) does not exist.

But the workspace does exist when looking at the build computer. So for debug perpose I have added a call to "tf.exe workspaces" to get a list of all workspaces, before we try to delete.

In the error case, you see that the workspace owner is not in english, but in german:

tf.exe workspaces /collection:http://tfs.siplaceworld.net:8080/tfs/DefaultCollection/
Collection: http://tfs.siplaceworld.net:8080/tfs/DefaultCollection
Workspace   Owner                                               Computer  Comment
----------- --------------------------------------------------- --------- -------
MCHC16074   ASM AS SW-Dev Build                                 MCHC16074 
ws_1678_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1693_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1695_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1700_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1719_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1744_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1747_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_1749_167 Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_461_169  Builddienst für Projektsammlung (DefaultCollection) MCHC16074 
ws_470_169  Builddienst für Projektsammlung (DefaultCollection) MCHC16074

This is sporadic and we have no idea on what it depends. How is it possible that the workspace owner is sometimes listed in german and sometimes in english?

Any help appreciated!


Solution

  • To delete an existing workspace, you must be the owner or have the global Administer workspaces permission set to Allow.

    You could also try to use onwer uniq ID instead of name. Get the owner uniq ID:

    tf vc workspaces ws_1749_167 /computer:* /format:xml /collection:https://dev.azure.com/xxx/
    

    After this it will return the info of owner uniq ID . Then delete the workspace with owner uniq ID:

    tf workspace /delete ws_1749_167;{owner uniq ID}
    

    For details , please refer to this ticket.