Learn how to a build a cloud-first strategyRegister Now


PVCS from vbscript via TeamCity Command line runner fails

Posted on 2009-02-23
Medium Priority
Last Modified: 2013-11-25

We use TeamCity as our CI server, and are very happy with it.  I'm trying to integrate a home-grown tracking system that we use for, among other things, specifying SQL dependencies and apply order for builds.  The tracking system stores everything in MSSQL 2k, while version control is in PVCS.  Moving away from PVCS for these files is not an option at the moment.

I have written a vbscript that does a few things, etc etc, gets a list of files, and processes them.  It runs fine from the command line.  When run from the TeamCity Command Line Runner, it fails.  

I use two PVCS command line tools, vcs.exe to apply a promotion group, and pcli.exe to get the file, and apply a version label.  vcs.exe returns error code 1, pcli returns error code 3.  

Teamcity service and agent both run as 'teamcity', a domain user account.
v:\pvcs is mapped to the repository. teamcity user has been given full control
d:\build is a temp directory. teamcity user has been given full control

The PVCS client runs and works fine - sees the repository no problem.
PVCS command line tools are in the path and can be run no problem.  Looking at the agent environment in TeamCity, the path lists them there as well.

The code box lists some log output from team city.  When something fails, I output the cmdline that was trying to run.  I can copy and paste that and it will run successfully.
[11:23:29]: [AdminMiscellaneous.html] runCmd
[11:23:29]: [AdminMiscellaneous.html] Failure: Couldn't apply TEST promotion group. Code: 1; Command: vcs -cV:\PVCS\archives\ctpkppx1.cfg -#3 -Y -gTEST:1.6 v:\pvcs\archives\com\docs\html\AdminMiscellaneous.html
[11:23:31]: [AdminMiscellaneous.html] runCmd
[11:23:31]: [runCmd] 11:23:31 Feb.23.09 [Error]
[11:23:31]: [runCmd] The project root could not be loaded: "v:\PVCS".
[11:23:31]: [AdminMiscellaneous.html] Failure: Couldn't get AdminMiscellaneous.html. Code: -3; Command: pcli run -y get -prv:\PVCS -nm -ad:\build\pvcs -o -bp/ -r1.6 /com/docs/html/AdminMiscellaneous.html

Open in new window

Question by:Hecatonchires
  • 2
  • 2
LVL 24

Accepted Solution

purplepomegranite earned 2000 total points
ID: 23726957
You say that TeamCity runs as a service, and also that you are using mapped drives?  If the Command Line Runner is running in the context of the service, mapped drives are not available, so this will fail.

More info at: http://support.microsoft.com/kb/180362

Is this likely to be the problem?  If so, you could try changing all the paths to UNC - this should resolve it.

Author Comment

ID: 23728540
That... does not make me happy.  PVCS is required to run with a drive letter, under this configuration anyway and with this version anyway.  I'll do some poking on PVCS and see if I can access it using a UNC.  Leaving this open a little longer, but at the moment you're getting the points purple.  
LVL 24

Expert Comment

ID: 23728953
After digging a little more, it seems that it is possible to map a drive in a service.  I have found many mentions of it but so far unfortunately the links to the code or working examples (outside VB or VB.Net) have disappeared.

One thing that does need to be done is for the service itself to map the drive.  A service runs in it's own session (even if it shares the user account), so any mapped drives are not available when the service starts.  However, it seems that it is possible to map the drive once the service is started...  But I just can't find any articles that show how this could be done from VBScript (apparently net use, etc. does not work).

That said, due to the KB article and MS's advice (there are loads of references saying services should use UNC not mapped drives), the best solution would be to find some way to get it to use UNC.

Author Closing Comment

ID: 31550397
It's definitely the problem.  Already have 1 command working, the other looks like it will require some more fiddling.  Thanks for the help PP

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
Simple Linear Regression
Screencast - Getting to Know the Pipeline

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question