Pause Project - REST API

Hi

Is there a way that I can pause all build configurations within a project by giving the project id?

I wrote a script to do this which gets all builds for project id, pauses them - but I have to then go through all queued builds, and also running builds to  cancel them.

I know on the UI it gives me the option of cancelling queued builds. I''d just like to know if it's possible with using the REST API.

 

Example of the script:

PutRequest(getTeamCityRestApiUrl() + 'buildTypes/id:' + buildType + '/paused', 'false')

 

Is it possible to add more parameters to cancell all builds for that id? 

3 comments

It's not possible to cancel the builds from the REST call directly, but it should be possible to cancel all builds from a build type on a single request by simply ensuring the builds locator covers them all.

0

Hi Denis

I can currently cancel builds running on agents, and in the queue. But what I'd like to be able to do is to cancel all builds by a build type when I pause - similar to when I pause a build configuration and I have the option to cancel all queued. Or even better if I'm able to do it at a project level

It's just a concern that if there are 1000's of builds queued, then this would be a lot harder to handle.

 

I don't think adding in a build locator - eg buildTypes?locator=affectedProject:<projectId>/paused - adding "true" in plain text to the request

or likewise for cancelling all builds by the locator. 

0

Hi,

 

As I mentioned, this isn't currently possible, and it should be pretty straightforward, when requesting pausing a build configuration via the REST API, to send a second request to cancel all builds. We can't really see that having thousands of builds queued it would be harder to handl than instead of passing an extra parameter doing a separate, one-way REST call.

 

If you would still like to see this as a feature, please open a request in our tracker. We would request that you please explain the scenario and why the single-separate call wouldn't work.

0

Please sign in to leave a comment.