Sequential build

Currently there is no out-of-the-box  way of making sequential builds in TFS, so I took a look at the REST API, that TFS provides.

Add a Powershell build step to the definition and call an inline script like this:

$TFSUri = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
$project = "[Team Project]
$BuildID = [BuildID]
$json = @"
{
  "definition": { "id": $BuildID  }
}
"@
Invoke-RestMethod -Method Post -UseDefaultCredentials -ContentType application/json -Uri "$TFSUri/$project/_apis/build/builds?api-version=2.0" -Body $json

Note. Change [Team Project] and [BuildID] to correct values.

For more info about API see Build

 

Author: KimC

TFS admin and deployment fellow

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s