How in powershell get current build definition -



How in powershell get current build definition -

i have code, on powershell lastly successful build definition. how can alter code, show lastly build. or if build in progress, show current build?

[void][system.reflection.assembly]::loadwithpartialname("microsoft.teamfoundation.client") [void][system.reflection.assembly]::loadwithpartialname("microsoft.teamfoundation.build.client") [void][system.reflection.assembly]::loadwithpartialname("microsoft.teamfoundation.build.common") $tfscollectionurl = "http://servertfs:8080/tfs/test" $server = new-object microsoft.teamfoundation.client.tfsteamprojectcollection(new-object uri($tfscollectionurl)) $buildserver = $server.getservice([microsoft.teamfoundation.build.client.ibuildserver]) $builddetail = $buildserver.querybuilds("nameproject", "namebuilddefinition") | { $_.builddefinition.lastgoodbuilduri -eq $_.uri } #| select buildnumber $builddetail

simply remove filter limits results 'last successful build' builds , apply appropriate filter there:

$builddetail = $buildserver.querybuilds("nameproject", "namebuilddefinition") | sort -desc starttime | select -first 1 $builddetail | ft buildnumber, starttime, status

extra: might want @ using builddetailspec , specify maxbuildsperdefinition may quicker if performance issue: http://www.incyclesoftware.com/2012/09/fastest-way-to-get-list-of-builds-using-ibuildserver-querybuilds-2/

(edit: maxbuildsperdefinition on own first build, somewhere start)

powershell

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -