Programatically bulk updating teamcity jobs, ID query

So I have a task to come up with a method of blocking all jobs in a teamcity environment with one or two steps ( we currently have almost a dozen environments) I've come up with two possible methods which will require either adding a new build step or agent requirement to every job (we've got hundreds)

We're on teamcity 9 now so I've exported the config in git and have been poking about. I reckon I can cobble together a script to run through and inject the required config blocks in the right places, the only thing I'm wondering about is the ID. Depending on which method I use, I'll either need a new runner ID or extension ID. It's trivial to do a search, find the highest existing one and increment from there.

But I'm wondering about the effects of just making these IDs up myself, is that OK? Do they need to come from somewhere else?

I also notice that the IDs aren't unique, it looks like if you copy a job, then the copy will have the same runner and extension IDs, that's strongly suggesting that it is OK to just make them up. So basically I'm wondering what the ID numbers are for if they're not for identification and not unique.

3 comments
Comment actions Permalink

Hi,

Runner id should be unique within one build configuration, otherwise you will get an error message in UI.
I think that the better solution will be to pause needed build configurations. For example you can pause them using REST API:
curl -u user:pass --request PUT http://localhost:8111/httpAuth/app/rest/buildTypes/id:<buildConID>/paused --data true --header "Content-Type: text/plain"

Also you can pause the build queue.

0
Comment actions Permalink

pausing the queue is sometimes useful, but mostly we need to just pause one or two environments, while allowing the others to carry on. Also, pausing jobs doesn't stop somebody going and running it anyway.

0
Comment actions Permalink

We have the related feature request - https://youtrack.jetbrains.com/issue/TW-5146, please watch/vote for it.

0

Please sign in to leave a comment.