如何让 teamcity 在每次成功构建时运行 .bat 文件?

发布于 2024-08-19 13:39:26 字数 273 浏览 6 评论 0原文

我有一个 teamcity (4.something) 安装,它创建 .wsp 文件以部署到共享点。目前,我必须将 wsp 从构建工件目录复制到我创建的一个小部署文件夹中。在该文件夹中,我运行一个 .bat,将新的 .wsp 部署到我们的测试服务器。 我可以采取哪些步骤来自动化此操作?

将 .bat 复制到工件文件夹并更新路径等,或者从工件文件夹复制到“部署”文件夹并从那里运行 .bat。

当涉及到 MSBuild 等的复杂性(或基础知识!)时,我是一个新手……因此,值得赞赏!

I have a teamcity (4.something) install that creates .wsp file for deployment to sharepoint. Currently I have to copy the wsp out of the build artifacts directory and into a little deploy folder I have created. In the folder I run a .bat that deploys the new .wsp to our test server.
What steps can I take to automate this?

Either copy the .bat into the artifacts folder and update the paths etc or copy from the artifacts folder into the 'deploy' folder and run the .bat from there.

I am a neophyte when it comes to the intricacies (or basics!) of MSBuild and the like... so hand holding is appreciated!

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

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

发布评论

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

评论(2

习惯成性 2024-08-26 13:39:26

在 TeamCity 的最新版本中...

在构建定义中,您可以识别可以复制/压缩的工件。然后可以手动下载工件或从另一个版本引用工件(工件依赖项)。

您可以设置“构建配置”,直接从 ci 构建生成的工件进行部署。

  • 创建一个构建来执行部署
  • 构建步骤
    • 运行:带参数的可执行文件
    • 命令可执行文件:.bat 文件(确保它作为生成的 ci 构建工件的一部分)
    • 命令参数:补丁文件需要的任何参数
  • 依赖项
    • 添加新的工件依赖项
    • 取决于:选择您要部署的 ci 版本
    • GetArtifacts from:上次成功构建
    • 工件规则:+:**/*.*

因此,给定的工件(如批处理文件)位于 CI 中构建...您现在有一个“部署”构建。当您运行它(手动或设置构建触发器)时,它会将所有 CI 构建工件复制到其工作目录(工件依赖项),然后运行批处理文件来进行部署。

相当光滑。

注意:只需确保运行 TeamCity BuildAgent 的帐户有权执行所有部署操作。

希望这对某人有帮助,因为我花了一段时间才解决这个问题;)

In more recent versions of TeamCity...

In the build definition you can identify artifacts which can be copied/zipped. Artifacts can then be downloaded manually or referenced from another build (Artifact Dependency).

You can setup a 'build configuration' to do your deployment directly from artifacts produced by your ci build.

  • Create a build to do your deployment
  • Build Step
    • Run: Executable with parameters
    • Command executable: .bat file (make sure it as part of the ci build artifacts generated)
    • Command parameters: whatever parameters your patch files needs
  • Dependencies
    • Add New Artifact dependency
    • Depend on: select the ci build you want to deploy
    • GetArtifacts from: Last successful build
    • Artifact rules: +:**/*.*

So, given artifacts (like your batch file) are in the CI build... You now have a 'deploy' build. When you run it (manually or setup a Build Trigger) it will copy all the CI build artifacts to it's working directory (Artifact Dependency) and then run your batch file to do the deployment.

Pretty slick.

note: just make sure that the account running the TeamCity BuildAgent has permissions to do all the deployment stuff.

Hope this helps somebody as it took me a while to sort this out ;)

酷到爆炸 2024-08-26 13:39:26

我通过创建一个 nant 任务,然后让 TeamCity 执行该 nant 任务来完成此操作。这比应有的痛苦还要严重。您应该能够使用 MSBuild 执行与生成后事件相同的操作。

I've done this by creating a nant task, and then having TeamCity execute the nant task. It's more of a pain than it should be. You should be able to do the same as a post-build event with MSBuild.

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