How to re-enable a commit into TFS?

965 views Asked by At

My company uses Visual Studio Team Services (formerly Visual Studio Online, Team Foundation Service). As a developer I use git-tf to do my work with Git. To apply Continuous Integration I have Jenkins running that fetches the code from Team Services with a plugin that uses Team Explorer Everywhere CLC.

Lately during a commit to Team Services, this message came up:

gottfried@lubuntu-virtual-machine:~/git_repo$ git-tf checkin

Checking in to $/fireAnalytics: 12%, commit a0bfea1
git-tf: failed to pend changes to TFS due to the following errors. Please fix the errors and retry check in. TF10151: Cannot lock item $/fireAnalytics/packages/fdssuite/src/fdssuite/tests/couch_devices.png for check-out. The item $/fireAnalytics/packages/fdssuite/src/fdssuite/tests/couch_devices.png is checked out by Sascha Gottfried in workspace Hudson-hhpberlin fireanalytics-MASTER.

The workspace mentioned (workspace Hudson-hhpberlin fireanalytics-MASTER) is created by Jenkins CI server (with TFS plugin using TEE-CLC). The file mentioned is created during build step that runs integration tests and is not under version control.

The workspace is set up to use TFS plugin option 'use update'. Quote from docs

If this option is checked, then the workspace and work folder will not be removed at the end of build. This makes the build faster, but artifacts remain between builds. If it is not checked, the plugin will create a workspace and map it to a local folder at the start of the build, and then delete the workspace at the end of the build.

How my CI setup could affect a TFS checkin and how can I fix this situation?

2

There are 2 answers

0
Sascha Gottfried On BEST ANSWER

Apparently Jenkins CI server triggered a new build during my TFS commit, because the Jenkins job was setup to poll TFS repo each minute. I temporarily shutdown the Jenkins CI and the TFS commit was successful again.

4
jessehouwing On

Binary files are checked out exclusively by TFS because there is no way to merge any changes made to the file. It looks like you've checked out this file in a workspace on your name. You'll need to undo that checkout (or at least undo the lock) in the other workspace. You can do this from the Source Control Explorer or from the commandline.

From the standard command line you'd issue the

tf undo /workspace:"Hudson-hhpberlin fireanalytics-MASTER";"Sascha Gottfried" "$/fireAnalytics/packages/fdssuite/src/fdssuite/tests/couch_devices.png"

I suspect that the CLC commandline will be very similar (but I don't have it available to check at the moment).

When using a build account it's probably safer to configure it to do none-exclusive checkouts and to make sure that upon build failure (in case of a Gated Checkin) the locked files are released. These type of situations often occur on Gated Checkins that build latest+shelveset, but fail for some reason, leaving the files in the shelveset checked out. In case of binary files those checkouts will be exclusive.

You can also configure TFS to never check out binary files exclusively. In Visual Studio you'll find these settings under Team>Team Foundation Server Settings>Source Control File Types.