CircleCI Field Guide
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Disable All Builds (Kill Switch)

There may be situations where an organisation may wish to completely stop builds running through CircleCI.

This is may be viewed as a “break glass” scenario that requires manual intervention.

The following policy achieves this by blocking every build on the platform EXCEPT in the project id specified.

This project id should be for the project through which you deploy your policies, in order to be able to revert this policy when needed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
package org

policy_name["kill_switch"]
enable_rule["kill_switch"]

kill_switch = reason {
    not data.meta.project_id == "<project-id>"
    reason := "Kill switch has been activated"
}
hard_fail["kill_switch"]

This policy produces the following message in the UI.

CircleCI UI showing the reason the build failed policy and was not executed
CircleCI UI showing the reason the build failed policy and was not executed