TeamCity + HG. Only pull (push?) passing builds
Feels like with the popularity of continuous integration this one should be a piece of cake but I am stumped. I am setting up TeamCity with HG. I want to be able to push changesets up to a repository that TeamCity watches and runs builds on changes. That's easy.
Next, if a build passes, I want that changeset to be pulled into a "clean" repository... one that conta开发者_JAVA技巧ins only passing changesets. Should be easy but...
TeamCity 6 supports multiple build steps and if any step fails, the rest don't run. My thought was to put a build step at the end that does a pull (or optionally a push?) to get the passing changeset into the clean repository.
I am trying to use PsExec to run hg on the box with the repositories.
If I try to run just a plain 'hg pull' it can't find the hg.exe even though it is set in the path and I have used the -w flag.
I have tried putting a .bat file in the clean repository that takes a revision parameter and it works fine... locally. When I try to run the .bat file remotely (using PsExec) it runs everything fine but it tries to run it on the build agent. Even if I set the -w argument it runs the .bat file there but tries to run the contents on the build agent box.
Am I just WAY off in my approach? Seems like this is a pretty obvious thing to do so either my Google skills are waning or no one thinks this is worthy of writing about. Either way, I am stuck in SVN land trying to get out so I would appreciate some help!
Instead of running the command directly, have you tried running it under a shell instead? This will make sure you get the environment variables which you are expecting. If you don't use the command shell, it will execute the command directly without setting the environment so you would have to fully specify the path to the hg executable.
Try a commandline for psexec such as: psexec c:\windows\system32\cmd.exe /c hg.exe
Adding in the machine name and hg subcommand appropriately, of course.
Add the following lines to your powershell profile:
function hg {
cmd /c hg.exe $args
}
If it doesn't recognize hg.exe
, you may need to add it to your Path:
$env:Path = $env:Path + ";C:\Program Files\TortoisHG\";
(You can just type notepad $profile
into the command prompt. it will open the file for you to edit in Notepad. Copy&paste this line and then save, exit.)
(see PowerShell alias syntax for running a cmd.exe builtin function?)
精彩评论