Skip to content

Instantly share code, notes, and snippets.

@gwsu2008
Created June 3, 2020 06:15
Show Gist options
  • Save gwsu2008/c99964c55cce59aadb149d2834d5ceaf to your computer and use it in GitHub Desktop.
Save gwsu2008/c99964c55cce59aadb149d2834d5ceaf to your computer and use it in GitHub Desktop.
jenkins-auto-approve-script.groovy
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval
ScriptApproval scriptApproval = ScriptApproval.get()
scriptApproval.pendingScripts.each {
scriptApproval.approveScript(it.hash)
}
/* Script to clear script approval
$JENKINS_HOME/init.groovy.d/disable-script-security.groovy:
*/
import javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration
import jenkins.model.GlobalConfiguration
// disable Job DSL script approval
GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class).useScriptSecurity=false
GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class).save()
@IreshMM
Copy link

IreshMM commented Feb 28, 2024

this helped me. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment