简体   繁体   English

在本地测试TFS构建工作流

[英]Test TFS Build Workflow Locally

I maintain our build process on our TFS 2012 system. 我在TFS 2012系统上维护构建过程。

Up till now I've been making changes locally to a solution that generates our custom activity DLLs. 到目前为止,我一直在本地更改生成自定义活动DLL的解决方案。 These DLLs are checked into TFS and are used by the build controllers and agents for the custom activities in our custom build template. 这些DLL被检入TFS,并由构建控制器和代理用于我们的自定义构建模板中的自定义活动。

For all of my code and workflow activities I have a unit test library that I can locally run to put in some base test values. 对于我的所有代码和工作流活动,我有一个单元测试库,我可以在本地运行以输入一些基本测试值。 While this gives me a good idea at how my custom tasks will run it is not optimal. 虽然这让我对自定义任务的运行方式有了一个很好的了解,但这并不是最佳选择。

What I would like to be able to do is run the entire build definition. 我希望能够做的是运行整个构建定义。 Is there a way to test the whole build process locally so that I can be sure that my changes to the workflow are acceptable before checking in and kicking off a build? 有没有办法在本地测试整个构建过程,以便我可以确保在签入和启动构建之前我对工作流的更改是可接受的? Right now my builds take between 30 and 40 minutes to complete and I would like to be able to start, monitor, debug, and stop the build locally without occupying one of our agents. 现在我的构建需要30到40分钟才能完成,我希望能够在本地启动,监控,调试和停止构建,而无需占用我们的代理。

Edit Another method for me to solve this problem is to come up with some manner to execute the workflow that is the build template locally. 编辑我解决此问题的另一种方法是提出一些方法来执行本地构建模板的工作流。 Has anyone been able to do this? 有没有人能够做到这一点?

Take a look at the Ranger Build Customization Guidance. 看看Ranger Build Customization Guidance。 There is a HOL for doing a lot of this. 有一个HOL可以做很多这样的事情。 It doesn't look like it is in v2 so take a look at v1.2. 它看起来不像v2所以请看一下v1.2。

http://vsarbuildguide.codeplex.com/releases/view/87995 http://vsarbuildguide.codeplex.com/releases/view/87995

If I am understanding the issue correctly, one way to do this may be: 如果我正确理解了这个问题,一种方法可能是:

  1. Install a build agent locally and register it with the TFS Build Controller. 在本地安装构建代理并使用TFS构建控制器注册它。
  2. Give the new agent a custom tag so it doesn't get assigned other builds from the queue 新代理提供自定义标记,以便不从队列中分配其他构建
  3. Shelve your changeset 搁置你的变革
  4. In VS, right click the build definition you want, and select queue new build. 在VS中,右键单击所需的构建定义,然后选择队列新构建。 A "Queue Build" window will open 将打开“队列构建”窗口
  5. Under the general tab, "What do you want to build", select your shelveset. 在常规选项卡“您要构建什么”下,选择您的搁置集。
  6. Under Parameters tab ->Advanced -> agent settings, enter your agent's tag. 在参数选项卡 - >高级 - >代理设置下,输入代理的标记。
  7. Click queue. 单击队列。

I accomplish this using a modified version of @malexander recommendation. 我使用@malexander推荐的修改版本来完成此任务。

  1. Create a code branch in TFS, commit your changes there, especially the changes to your custom activity DLL's (compiled binaries, not just source). 在TFS中创建一个代码分支,在那里提交您的更改,尤其是对自定义活动DLL(已编译的二进制文件,而不仅仅是源代码)的更改。
  2. Install a TFS Build Controller and Build Agent locally, registering the controller with your TFS server. 在本地安装TFS Build Controller和Build Agent,向TFS服务器注册控制器。
  3. Configure your new local controller to use your modified custom activity DLL's, stored in your new TFS code branch. 配置新的本地控制器以使用存储在新TFS代码分支中的已修改的自定义活动DLL。 Team Explorer > Builds > Actions > Manage Build Controllers > (select your new local controller) > Properties > Version control path to custom assemblies 4. Team Explorer > Builds > Actions > Manage Build Controllers > (select your new local controller) > Properties > Version control path to custom assemblies 4。
  4. Queue a new build, from an existing TFS build definition: change its controller to use your new local controller. 从现有TFS构建定义中对新构建进行排队:更改其控制器以使用新的本地控制器。
  5. The new build will execute on your local controller/agent, using your modified custom activity DLL's, without interfering/restarting your production agents. 新构建将使用修改后的自定义活动DLL在本地控制器/代理上执行,而不会干扰/重新启动生产代理。

Also: since you're in your own code branch, you can commit debug versions of your custom activity DLL's, without impacting your production agents. 另外:由于您在自己的代码分支中,因此可以提交自定义活动DLL的调试版本,而不会影响您的生产代理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM