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:


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.

Comments (3)

  1. Jorge says:

    Hello! And Congratulations for your post!

    I use this to automatice my build and works perfect!

    But I want to request a new build and wait for it success end, how can I make?

    I can't use Monitor Build task because it's a starting task and you can't put it as the after Request Build task.

    How do you resolve this?

    Thanks you for the posts!

  2. Hi Jorge,

    Per Orchestrator design the monitor activity can only be the first activity in a Runbook.  For your scenario, I would use a "Get Build Details" and set a link point to itself, the link condition is to check if the build has completed.  Essentially it is like a while loop.

    "Monitor Build" is primarily to monitor a particular build definition where we don't know when a build could come, and has to do something when a build is completed.  This monitor activity can be replaced with other activity with appropriate link conditions.



  3. Jorge says:

    Thanks you very much for the help Yao!

    Your recomendation has been very usefull!


Skip to main content