如何让 teamcity 在每次成功构建时运行 .bat 文件?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 TeamCity 的最新版本中...
在构建定义中,您可以识别可以复制/压缩的工件。然后可以手动下载工件或从另一个版本引用工件(工件依赖项)。
您可以设置“构建配置”,直接从 ci 构建生成的工件进行部署。
因此,给定的工件(如批处理文件)位于 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.
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 ;)
我通过创建一个 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.