Strange behavior on Windows running TeamCity services as user vs 'local system account'

I'm using TeamCity Pro 6.0.1 on Windows 7 and I originally had the TC services running with the 'local system account'. I have a Maven2 configuration that uses Subversion as the VCS, and I enabled code coverage. Everything was working great. Builds were fine. Tests were running. Code coverage was produced and Maven2 build info was shown.

Because I wanted the TC build agent to use my Maven local repository (~/.m2/repository), I changed the TC services to run as me. The services (re)started fine, and builds were running as before. Except for code coverage. No code coverage. The error was

Failed to generate coverage report, error: C:\TeamCity\buildAgent\work\c02175388bc3e6ac\coverage.ic file does not exist

After some investigation I felt the issue was that the buildAgent\work directory was owned by the local admin account rather than me. So I changed ownership on all the files and subdirectories of C:\TeamCity. I verified the change on the directory in buildAgent\work.

When I ran a build again, still no code coverage, and the same error.

What I noticed is that the directory c02175388bc3e6ac was changed to be owned by the local admin account. I have TC set 'Clean all files before build' so the c02175388bc3e6ac is recreated by the build agent. But it's getting created with the local admin user as the owner, rather than me, even though the build agent service is running as me.

What's strange is that the build itself works i.e. mvn is creating 'target' directories, compiling files, building artifacts, all without any permission issue. Yet the coverage.ic file isn't getting generated.

The only thing that's changed in the TC configuration is that TC is running as me. To see if that was true, I set the TC services back to run as the local system account. Everything worked and I got the code coverage.

What gives?

An interesting addtional side effect, that I don't understand, is that the 'Maven Build Info' tab was also missing when the code coverage was missing.

Anyway, I have a workaround, but heads up to JetBrains.

Comment actions Permalink

raysuliteanu schrieb:

An interesting addtional side effect, that I don't understand, is that the 'Maven Build Info' tab was also missing when the code coverage was missing.

TeamCity hides tabs when the reports base path (ie a zip-file with your maven build info) is not available.

Comment actions Permalink

Hi Ray

I believe you mean Administrators group own the files, not a specific account. This is intended Windows behavior - if your account is a member of Administrators group then all created files and folders are owned by the group, not your account personally. In Windows 7 you have restricted security token due to UAC, so the behavior differs. But if you start a process with elevated privileges (run as administrator) and create some files - they'll have the same ownership granted to Administrators group. TeamCity agent works as a service and has elevated token continuously. Here the difference.

But ownership by itself doesn't matter much in this case. Please check that your account has permissions to access the folder.
Alternativelly you could grant access to a repository within your usep profile to SYSTEM account.



Please sign in to leave a comment.