TeamCity 3.1.2 and Windows drive letters

Hi,

I have a particular Windows problem that I don't seem to be able to solve.

I have written an ant build.xml wrapper script that calls targets from subprojects' build.xmls. The wrapper script target builds and deploys war files to a Tomcat 5.5 installation on another machine. First it execs "net stop Apache Tomcat", then it builds/deploys the war to the remote computer, then it starts tomcat.

I have mapped drive H on the build agent to be:
]]>\C$\Program Files\Apache Software Foundation\Tomcat 5.5. I need to set a variable called tomcat.home to the target Tomcat installation where it will then copy the war file to %tomcat.home%\webapps. This works perfectly on a command line when I add "-Dtomcat.home=H:" to the ant command. I have also added this command line argument to the "Additional Ant command line parameters" in the Runner tab of the TeamCity build. But, TeamCity does not see the drive letter and fails. Any Windows expert (I'm more of a 'nix guy) have any suggestions?

Thanks,
-Dave

6 comments

Dave,

I had a very similar issue to yours. I found this article from Microsoft explaining that a service should not use mapped drives. I assume that TC runs as service in your setup. I also tried to use the UNC path (
]]>\...), but this is not yet supported by TC. I filed a request in the issue tracker for that. Maybe you can vote for it, so Yegor and the gang can fix it. :)

Hope this sheds some light on the problem for you.

Regards,
Oleg.

0

Thanks for the feedback, Oleg.

This does seem similar to my problem. I have voted for your issue. Maybe that will help to get it into TC 4.0.

-Dave

0

Hello Dave,

For a workaround, you can try to start the agent service under different
credentials (not the default local system one the services are started with),
that have access to the mapped drive. You can configure this on the Log On
tab of the service properties dialog.

HTH,
Andrei

DL> Thanks for the feedback, Oleg.
DL>
DL> This does seem similar to my problem. I have voted for your issue.
DL> Maybe that will help to get it into TC 4.0.
DL>
DL> -Dave
DL>


0

Andrei -

I have already changed the user that starts up the Tomcat Windows service on the target machine. As I say, when I run the build using ant from a command prompt, the build works perfectly: it stops Tomcat on a different machine, builds/deploys the war files on the target machine and restarts Tomcat on the target machine. But, it just doesn't work through TeamCity.

-Dave

0

Hello Dave,

Sorry, maybe I'm missing something and you already did this, but just in
case:

It's the user the TeamCity agent runs under that needs to be changed.

When you run the ant script from a command prompt you use your credentials.
When the build script is executed by the TeamCity agent, the default system
account is used (the one that the service runs under), unless you change
it. That account does not have access to mapped drives on remote machines.

HTH,
Andrei


DL> Andrei -
DL>
DL> I have already changed the user that starts up the Tomcat Windows
DL> service on the target machine. As I say, when I run the build using
DL> ant from a command prompt, the build works perfectly: it stops
DL> Tomcat on a different machine, builds/deploys the war files on the
DL> target machine and restarts Tomcat on the target machine. But, it
DL> just doesn't work through TeamCity.
DL>
DL> -Dave
DL>


0

Oh. I see. I had done that long ago. i.e. Changed the user that starts the TeamCity Agent Windows service from the system user to my own login (who has admin rights to the build agent box).

-Dave

0

Please sign in to leave a comment.