团队城市 + HG。只拉(推?)传递构建

发布于 2024-10-07 05:23:05 字数 626 浏览 0 评论 0原文

感觉随着持续集成的流行,这应该是小菜一碟,但我被难住了。我正在与 HG 设置 TeamCity。我希望能够将变更集推送到 TeamCity 监视并基于变更运行构建的存储库。这很容易。

接下来,如果构建通过,我希望将该变更集拉入一个“干净”的存储库......一个仅包含通过的变更集的存储库。应该很简单,但是...

TeamCity 6 支持多个构建步骤,如果任何步骤失败,其余步骤将不会运行。我的想法是在最后放置一个构建步骤,执行拉动(或可选的推送?)以将传递的变更集放入干净的存储库中。

我正在尝试使用 PsExec 在带有存储库的盒子上运行 hg 。

如果我尝试仅运行一个普通的“hg pull”,它将找不到 hg.exe,即使它已设置在路径中并且我已使用 -w 标志。

我尝试将 .bat 文件放入干净的存储库中,该存储库采用修订参数,并且在本地工作正常。当我尝试远程运行 .bat 文件(使用 PsExec)时,它运行一切正常,但它尝试在构建代理上运行它。即使我设置了 -w 参数,它也会在那里运行 .bat 文件,但会尝试运行构建代理框中的内容。

我的方法还差得远吗?看起来这是一件很明显的事情,所以要么我的谷歌技能正在减弱,要么没有人认为这是值得写的。不管怎样,我被困在 SVN 的土地上,试图摆脱困境,所以我希望得到一些帮助!

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 contains 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

潇烟暮雨 2024-10-14 05:23:05

您是否尝试过在 shell 下运行它,而不是直接运行该命令?这将确保您获得所需的环境变量。如果您不使用命令 shell,它将直接执行命令而不设置环境,因此您必须完全指定 hg 可执行文件的路径。

尝试使用 psexec 的命令行,例如: psexec c:\windows\system32\cmd.exe /c hg.exe

当然,适当地添加计算机名称和 hg 子命令。

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.

无畏 2024-10-14 05:23:05

将以下几行添加到您的 powershell 配置文件中:

function hg {
    cmd /c hg.exe $args
}

如果它无法识别 hg.exe,您可能需要将其添加到您的路径中:(

$env:Path = $env:Path + ";C:\Program Files\TortoisHG\";

您只需输入 notepad $profile > 进入命令提示符,它将打开文件供您在记事本中进行编辑,然后保存并退出。)

(请参阅 用于运行 cmd.exe 内置函数的 PowerShell 别名语法?

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?)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文