Jenkins calling groovy script security errors

2019-07-25 14:29发布

I'm currently working on running bentolor's idea-cli-inspector in my pipeline for static analysis. Unfortunately, I cannot find any documentation on how to allow parameters using the "load" command, and this command works by bringing in source anyway, so I made my own function, but unfortunately, it isn't quite working out (probably due to script security).

Function:

def callIdeaInspector() {
    String[] args = ['-i', '/Applications/Android\\ Studio.app/', '-p', '.idea/inspectionProfiles/CompanyName.xml', '-d',
        'src/main/java/com/CompanyName/', '-l', 'ERROR']
    Binding context = new Binding(args)
    result = new GroovyShell(context).evaluate(new File("../btMobileApp/ideainspect.groovy"))
}

Error:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified new groovy.lang.Binding java.util.ArrayList

1条回答
放我归山
2楼-- · 2019-07-25 15:21

Go to Manage Jenkins → In-process Script Approval and approve all requests there. Re-run the script and repeat the process if needed.

查看更多
登录 后发表回答