Searching Queued Builds on a given Agent / Controller

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Jaimin Modi Jaimin Modi 7 months, 2 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #35201
    Profile photo of Jaimin Modi
    Jaimin Modi
    Participant

    I am trying to retrieve queued builds from TFS Server using the IBuildServer Interface. However I am not able to retrieve queued builds on specific agents for a given controller. That is required because if there is a build in progress the Cache Deletion should not happen.

    $tfsservername = 'TFS LINK'
    
    [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") 
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.WorkItemTracking.Client")
    
    $server = new-object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection(New-Object Uri($tfsservername)) 
    # creating TFSServer Instance
    $buildServer = $server.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer]) 
    
    
    $spec = $buildServer.CreateBuildQueueSpec('*','*')
    $build = $buildServer.QueryQueuedBuilds($spec).QueuedBuilds
    
    

    I tried searching for methods of IBuildServer but there is no method that links Agents and Queued Builds.

    I want to use IQueuedBuild Interface here but i don't know how to use it.

    Any suggestions how can i find Queued builds on an specific agent ?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.