Created
March 18, 2018 16:42
-
-
Save kenych/2cd96233a92f6b8bbd1aadee0e54a857 to your computer and use it in GitHub Desktop.
Jenkins scriptApproval plugin config script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jenkinsci.plugins.scriptsecurity.scripts.* | |
ScriptApproval script = ScriptApproval.get() | |
ConfigObject conf = new ConfigSlurper().parse(new File(System.getenv("JENKINS_HOME") + '/jenkins_config/scriptApproval.txt').text) | |
conf.scriptApproval.approvedSignatures.each{ approvedSignature -> | |
println("checking for new signature ${approvedSignature}") | |
def found = script.approvedSignatures.find { it == approvedSignature } | |
if (!found){ | |
println("Approving signature ${approvedSignature}") | |
script.approveSignature(approvedSignature) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment