Enriching our build tweets

We have several Team Foundation projects now running concurrently, and switching between these projects and work-spaces in Visual Studio 2013 can be time consuming and frustrating chore.

For ease of use, I prefer to aggregate my build messages into a single location. In the past I've used the SonarQube build management to aggregate information about builds in a single repository, and I probably will again at some point in the future. But, at the moment we're using a hidden twitter account to push all status messages into.



The Tweet gives us a quick over-view of the build outcome.

We've added a BitLy link to each tweet that references an internal HTTP server that gives us quick access to the build transcript generated by TFS.

How we used Powershell to talk to Twitter is covered in an older post, but adding a Bit.Ly link is demonstrated below:

$username = "-----------"
$apiKey = "-------------------------------" # Legacy API Key

Function Get-ShortURL {
Param($longURL)
$url = "http://api.bit.ly/shorten?version=2.0.1&format=xml&longUrl=$longURL&login=$username&apiKey=$apiKey"
$request = [net.webrequest]::Create($url)
$responseStream = new-object System.IO.StreamReader($request.GetResponse().GetResponseStream())
$response = $responseStream.ReadToEnd()
$responseStream.Close()

$result = [xml]$response
Write-Output $result.bitly.results.nodeKeyVal.shortUrl
}


Get-ShortURL "http://server.local/Build26098.txt" 


Comments