Jenkins Job DSL introduced Script Security in 1.6, this gives some builds the following error:
ERROR: Build step failed with exception
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use
We run Jenkins masters entirely through configuration using plugins.txt and a set of Groovy scripts to configure Jenkins, and do not allow any configuration to be done through the UI, so we also disable the ability to login as an admin.
How can we programmatically pre-approve scripts through the Jenkins groovy configuration?