Friday, March 2, 2012

Disable All Build Definitions, Build Controllers and Build Agents using SQL

We had a situation where we need to disable all the build definitions, build controllers and build agents without bringing TFS up and running. This was on QA instance, we backed up and restored the database on QA from Prod, so when we brought QA TFS up, TFS QA started running all the scheduled builds on Prod build controllers, which caused the problem.

Here are the SQL commands I ran on TFS QA database, which disabled all the 600+ build definitions and 100+ controllers

Use TFS_<Collection Name>

--Disable Build Agents

Update dbo.tbl_BuildAgent Set [Enabled]= 0 Where [Enabled]=1

--Disable Controllers

Update dbo.tbl_BuildController Set [Enabled]= 0 Where [Enabled] =1

--Disable Build definitions

Update dbo.tbl_BuildDefinition Set [Enabled]= 0 Where [Enabled] =1

2 comments:

  1. Hi All,
    I am running TFS 2012 update 3. I don't see an ena bled column in the Build Definition table. Probably changed to support the new "paused" builds. Does anyone know how to disable builds now?

    thx
    kent

    ReplyDelete
    Replies
    1. There is now a queuestatus column

      build defintion queuestatus
      0 == enabled
      1 == paused
      2 == disabled



      Delete