disabling triggers.
Is it possible to disable all triggers with an SQL statement? We are running nightly backups of our productive environment and would like to test the restore. The problem is that all the triggers are active and the queue fills up on the test server. I have looked into doing this throught the rest interface and it would be possible. We would perfer to disable the triggers before starting the Team City Server.
Thanks
Please sign in to leave a comment.
Hi Ron,
You can manually pause the build queue before server start. The queue state is saved in <TC Data Directory>/config/plugin.queue-pauser.xml file. To pause the build queue please change <param name="queue-enabled" value="false" />. Then if needed you can manually delete all builds from the queue.
Triggers description are stored in xml files, not in database. So another option is to create a script that will modify .xml files of all build configurations stored in <TC Data Directory>/config/projects/<ProjectID>/buildTypes. It should find all triggers in
section and add triggers names to this section:
Hello,
In addition, a delete triggers could be done by script (this is not a disable, but could be ok for a restore check or environment load without impacts on the original target).
In <TC Data Directory> (aka: .BuildServer) directory, execute this shell command line;
Best regards
Disable them all even the paused ones
for i in $(curl -u creds:here --header "Accept: application/json" -X GET http://teamcity.url/app/rest/buildTypes/ | jq -r '.buildType[] | .id '); do curl -u credo:here -H "Content-Type: text/plain" -X PUT http://teamcity.url/app/rest/buildTypes/id:${i}/paused -d "true";done