0
votes

I'm working with TFS version 2015 SP3 and I'm having problems with creating a working Gated Checkin Build definition.

The Build proces steps are empty to prevent a failing build.

When the Build succeeds de build server tries to check in de gated changes and fail. The error message is:

The shelveset _Build_56625;Build\ead50f13-855a-45bd-9417-778e04e6fdfe could not be found for check-in

From what I can gather it has to do with the fact the build server uses the GUID of the build-user instead of the username. (see image below).

Error Build log

2016-09-27T14:22:59.3450903Z Checking if artifacts directory exists: C:\Agent_3\_work\1\a
2016-09-27T14:22:59.3450903Z Deleting artifacts directory.
2016-09-27T14:22:59.3607099Z Creating artifacts directory.
2016-09-27T14:22:59.3607099Z Checking if test results directory exists: C:\Agent_3\_work\1\TestResults
2016-09-27T14:22:59.3607099Z Deleting test results directory.
2016-09-27T14:22:59.3763337Z Creating test results directory.
2016-09-27T14:22:59.4232406Z Starting: Get sources
2016-09-27T14:22:59.4544938Z Entering TfvcSourceProvider.PrepareRepositoryAsync
2016-09-27T14:22:59.4544938Z localPath=C:\Agent_3\_work\1\s
2016-09-27T14:22:59.4544938Z clean=True
2016-09-27T14:22:59.4544938Z sourceVersion=68725
2016-09-27T14:22:59.4544938Z mappingJson={"mappings":[{"serverPath":"$/xxx","mappingType":"map","localPath":"\\"}]}
2016-09-27T14:22:59.4544938Z Syncing repository: xxx(TFVC)
2016-09-27T14:22:59.4544938Z workspaceName=ws_1_18
2016-09-27T14:23:00.3451244Z Undo any pending changes under workspace.
2016-09-27T14:23:01.2669675Z No inconsistencies were found to clean up.
2016-09-27T14:23:01.7044792Z Workspace Name: ws_1_18;Build\ead50f13-855a-45bd-9417-778e04e6fdfe
2016-09-27T14:23:01.7669760Z tf unshelve Gated_2016-09-27_04.22.53.2745;MyDomain\MyUser
2016-09-27T14:23:02.2413159Z edit: C:\Agent_3\_work\1\s\app\xxx\xxx.ts
2016-09-27T14:23:02.5225711Z Successfully unshelved Gated_2016-09-27_04.22.53.2745;MyDomain\MyUser into workspace ws_1_18;Build\ead50f13-855a-45bd-9417-778e04e6fdfe
2016-09-27T14:23:02.5225711Z tf get /version:68725
2016-09-27T14:23:03.0187586Z tf shelve _Build_56625 /replace
2016-09-27T14:23:03.1906333Z Successfully created new shelveset _Build_56625;Build\ead50f13-855a-45bd-9417-778e04e6fdfe
2016-09-27T14:23:03.2999952Z Done syncing repository xxx to version 68725 (workspace version C68725)
2016-09-27T14:23:03.2999952Z Leaving TfvcSourceProvider.PrepareRepositoryAsync
2016-09-27T14:23:03.4093700Z Running tasks

Yes... I've read:

On Premise Gated Check-in Fails with "The shelveset ... could not be found for check-in" - But I'm not willing to dump 5 years of history just to get this to work.

https://social.msdn.microsoft.com/Forums/en-US/8016349e-88dd-4fe1-aa6b-13c8d897985f/tfs-2015-on-premise-gated-checkin-fails-with-the-shelveset-could-not-be-found-for-checkin?forum=tfsbuild - This question gives me some insight but no working solutions.

We've tried

  • Creating a new agent
  • Trowing away the local workspaces
1
Works well with my TFS15. It's hard to troubleshooting this issue since we don't have your environment. Even though you have mentioned create a new team project is not your solution. However, you still can create one for test to narrow down this issue and see if gated check- in build works on the new created one?PatrickLu-MSFT
Have encountered an issue which only occurs on the project collection upgraded from TFS2013 but works well with new created TFS 2015 project collection.PatrickLu-MSFT
I have created a new project, created a new builddefinition, added gated checkin. Then checked in a new file. The build failed with a similar error: [Error]The shelveset _Build_56722;Build\ead50f13-855a-45bd-9417-778e04e6fdfe could not be found for check-inRalf de Kleine
How about create a new team project collection and team Project ? Which one are you running your build agent, Run as a service or Run interactively ? Did you build service account have enough permission to check-in the changeset?PatrickLu-MSFT
Normal Gated Checkins using the 'old' xaml builddefinition still work.Ralf de Kleine

1 Answers

1
votes

The cause of our problems was a double Build Identity in the Tfs_Configuration database.

With the following query you can check double identities:

SELECT * FROM tbl_Identity WHERE PartitionId = 1 AND TypeId = 8