简体   繁体   中英

Test TFS Build Workflow Locally

I maintain our build process on our TFS 2012 system.

Up till now I've been making changes locally to a solution that generates our custom activity DLLs. These DLLs are checked into TFS and are used by the build controllers and agents for the custom activities in our custom build template.

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.

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. There is a HOL for doing a lot of this. It doesn't look like it is in v2 so take a look at v1.2.

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.
  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. 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.

  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).
  2. Install a TFS Build Controller and Build Agent locally, registering the controller with your TFS server.
  3. Configure your new local controller to use your modified custom activity DLL's, stored in your new TFS code branch. 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.
  5. The new build will execute on your local controller/agent, using your modified custom activity DLL's, without interfering/restarting your production agents.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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