Back to Top

Choosing a specific TeamCity Build with BuildMaster

BuildMaster is an Application Release Automation tool. In this tutorial, we will demonstrate how to select a specific build in TeamCity, and pull a release package from that build.


Previously we ran through how to kick off a new build in TeamCity and then import that build into BuildMaster. This is the way most of our users integrate TeamCity, or any CI engine with BuildMaster, however there is another feature that some users take advantage of.

In this tutorial, we’ll set up a new Pipeline for the application we’re pulling from TeamCity so that we can pick a specific past build to import.

You can download the sample Otterscript plan and JSON files used in this tutorial.

Step 1: Create a new Pipeline

BuildMaster allows, and encourages, users to create multiple pipelines for their applications to cover a host of release scenarios. We’ll name this pipeline, Import Specific Build, as well as give it a color to clearly identify it as a non-standard pipeline.

This new pipeline will mirror the standard pipeline stages of Import, Integration, Testing, and Production from the previous tutorial.

On that same note we’ll also use the same Deployment Plan for Integration, Testing, and Production. Of course we can also add any Gates and Event Listeners as needed.

Step 2: Create a Release Template

We’ll next set an application variable and use that variable in a Release Template, which will allow us to pick a specific build definition, and build number.

First, we'll set the application level variable. This variable will set $TeamCityProject to the specific Project in TeamCity we're working with. In this case, Accounts. You set application variables under the settings tab.

We’ll then create our release template, name it, and set it to the new pipeline.

First, we'll add a Release Variable to pick which build configuration we want. We'll name it TfsBuildConfiguration, and make sure that the value is required and limited to items in list. We'll choose Dynamic List (TFS Build Definition), and set our credential and use the application variable ($TeamCityProject) as its type.

Next, we'll add a Package Variable to our template that will allow us to pick a specific build number. Again, the value will be required and restricted to list items. We'll name this variable TeamCityBuildNumber and it will also be a Dynamic List (TFS Build Number). Again, we'll set our credentials, use $TeamCityProject, and this time we'll use the variable we just set for the build definition ($TeamBuildConfiguration).

Also, we'll make sure that the value is required, and also limited to items in the list.

We now have a release template that, when used, will prompt us for a build definition and a specific build number. Next, we'll use these variables in a new deployment plan.

Step 3: Create a new Deployment Plan

Even if we’re using a previously defined deployment plan to move the application through the new pipeline, we still need to import the build, and we need a new plan for that. We’ll name the plan Import Previous Build.

This new plan will start with a General block and short description, and then add two operations, Import Artifact from TeamCity, and Set Release Package Number. The first operation will let us select a build to import using our variables.

The second will let us set the package number. We'll use the $TeamCityBuildNumber variable so that the package number is the same as the build number.

Please note that if you choose to set the package number to the same number as the build in TeamCity you may also need to change the Package Number Scheme to Date-based (which can be found under advanced settings) in certain situations. This allows for a package name to be reused in the same release.

We will then save and assign this new plan to the Import stage of our pipeline, and select the stage to automatically promote to the next stage of the pipeline, Integration.

Step 4: Create a new Release

Now that the new pipeline, plan, and template are in order we can create a new release using them.

We’ll create a new release, and set the template and pipeline to Import Specific Build. We'll also have a drop-down to choose our Build Definition, in this case Standard.

When we create our package another prompt will appear for the Build Number.

Once set, BuildMaster will then import the build number specified and the release package can be moved through the rest of the pipeline.