Jenkins调用Groovy脚本安全性错误 [英] Jenkins calling groovy script security errors

查看:397
本文介绍了Jenkins调用Groovy脚本安全性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在在管道中运行Bentolor的 idea-cli-inspector 用于静态分析.不幸的是,我找不到任何有关如何使用"load"命令来允许参数的文档,并且该命令无论如何都可以通过引入源代码来工作,因此我创建了自己的函数,但不幸的是,它的工作效果并不理想(可能是由于脚本安全性.)

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).

功能:

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"))
}

错误:

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

推荐答案

转到管理Jenkins→进程内脚本批准并批准那里的所有请求.重新运行脚本,并在需要时重复该过程.

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

这篇关于Jenkins调用Groovy脚本安全性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆