每个成功的构建,我如何可以让teamcity运行一个.bat文件? [英] How can I have teamcity run a .bat file on each successful build?

查看:666
本文介绍了每个成功的构建,我如何可以让teamcity运行一个.bat文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



将.bat复制到工件文件夹中,并更新路径等或从工件文件夹复制到'deploy'文件夹并从那里运行.bat。



当MSBuild等的复杂(或基础!))时,我是一个新手感谢
$ b

解决方案

在更新版本的TeamCity ...



在构建定义中,您可以识别可以复制/压缩的工件。然后可以手动下载工件或从其他构建引用工件( Artifact Dependency )。



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




  • 创建构建以执行部署

  • 构建步骤


    • 运行:具有参数的可执行文件

    • 命令可执行文件:.bat文件(确保它是生成ci构建工件的一部分)

    • 命令参数:您的补丁文件需要的任何参数


  • 依赖关系


    • 添加新的Artifact依赖关系

    • 依赖于:选择要部署的ci版本

    • GetArtifacts from:上一次成功构建

    • 伪装规则:+:** / *。*




所以,给定的工件(像您的批处理文件)在CI构建中...现在有一个部署构建。当您运行它(手动或设置构建触发器)时,将将所有CI构建工件复制到其工作目录(Artifact Dependency),然后运行批处理文件进行部署。


$ b $



注意:只需确保运行TeamCity BuildAgent的帐户具有执行所有部署内容的权限。



希望这可以帮助某人,因为我需要一段时间才能整理出来;)


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!

Thanks

解决方案

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

这篇关于每个成功的构建,我如何可以让teamcity运行一个.bat文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆