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.


Comment actions Permalink

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

      <build-trigger id="vcsTrigger" type="vcsTrigger">

section and add triggers names to this section:

      <setting-ref ref="vcsTrigger" />

Comment actions Permalink


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;

for FILE in `find config/projects/*/buildTypes/*.xml`; do sed -i '/<build-triggers>/,/<\/build-triggers>/d' $FILE; done

Best regards

Comment actions Permalink

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


Please sign in to leave a comment.