clear teamcity build queue

One morning we noticed TeamCity began spinning up hundreds - then thousands - of queued builds for a project.

There is no option in the TeamCity UI to simply "flush the queue" and by default the maximum number of builds in the queue is 3000.

So even if we manually clicked each build to remove it from the queue, they would queue faster than we could ever click.

While another engineer was reading off the TeamCity API, I quickly threw together a
script to clear out the queue so that teams could begin building again.

It was hacky, but it worked. Afterwards, I converted this script to a small
script which added a bit more flexibility and functionality.

I have since included this script in a broader Golang TeamCity API wrapper which includes some other useful functions.

These packages are continually being modified and extended but will be versioned, so be sure to use
go mod
to lock to a desired version. However backwards compatibility will always be a top priority.


last updated 2019-03-27T05:51:12+0000