Get the last build using TFS IP

In the deploy-test scenario, it is often needed to find the last good build.  By “last good build”, we mean the most recent build for a given build definition on TFS which has been built successfully and reached a certain quality level reflected by “Build Quality” field.  A common approach is to create a shortcut or junction named as “LATEST which points to the last known good build after testing, or copy the entire build drop directory.  It is not very reliable because this approach is not visible by and out of sync with the team build.  In the automated deployment context, Orchestrator along with TFS IP provides a simpler solution by using “Get Build Details” activity.

Suppose the “Build Quality” (the field is visible on Visual Studio IDE) is properly maintained by build-test process.  We simply use “Get Build Details” to retrieve one build with the following parameters:

  • Maximum builds per definition: 1.  We only need one build.
  • Build Query Order: StartTimeDescending.  It is the default value of this optional property.
  • Build Status: Succeeded.  We only care build that is finished successfully.
  • Build Quality: fill in the value as needed.

Here is the screenshot:

image

Note that I just checked in the change today.  So you will need to build the assembly by yourself and put it at C:\Program Files (x86)\Common Files\Microsoft System Center 2012\Orchestrator\Extensions\Support\Integration Toolkit\4e5fdf96-9cad-4233-8607-400288353bb6 if you want to use it right now.  Otherwise you can wait for the OIP update.