Sunday, April 21, 2013

How to Automate Builds with TeamCity (Part 5)

Please notice that this is a multi-part, step-by-step guide, on how to automate builds in TeamCity CI Server. You can find the parent article here, which has links to all the related posts.

Part 5:  Configuring the Build Parameters in TeamCity

The build parameters will depend on your build script (the one we created and added to the project before). In general, the more generic your script, the more parameters you will need to configure. If you use a generic build script, it means you can use the same script for all your projects within a solution and for all the different environments (you can use configuration transforms to change the settings for each environment automatically), but this means that then you need to inject the parameters required for each specific build. It is up to you to find a balance that works for your needs.

In my case, because of the build script that I’m using, I need to configure several environment variables that are going to be used by the build script.

Let’s get started by clicking on the “Build Parameters” section.

TC_build_web_23_thumb[2]

  1. Click on the Build Parameters section on the right hand menu. You will see the build parameters page.

    TC_build_web_24_thumb[2]
  2. To add a new parameter, click on the “Add new parameter” button. You will be required to enter a Name for the parameter, then select the type (in this case all of them will be Environment variables) and then the value, which should accurately match with your project values.

    TC_build_web_25_thumb[3]
  3. The following are the parameters I needed: Project Name, SolutionDir, SolutionFile, Configuration, BuildFilePath. Add each of them with the correct information.

We don’t need to do anything in particular for the last step, so it means at this point we are basically done with the basic setup of our Build configuration. Up to this point, we have done everything TeamCity needs to be able to retrieve our solution files from source control and build our web application.

Next:

Part 6: Running and Troubleshooting the TeamCity Build

No comments:

Post a Comment