【问题标题】:Jenkins calling groovy script security errorsJenkins 调用 groovy 脚本安全错误
【发布时间】:2016-05-20 13:51:18
【问题描述】:

我目前正在我的管道中运行bentolor 的idea-cli-inspector 以进行静态分析。不幸的是,我找不到任何关于如何使用“加载”命令允许参数的文档,并且这个命令无论如何都是通过引入源代码来工作的,所以我制作了自己的函数,但不幸的是,它并没有完全奏效(可能是由于脚本安全性)。

功能:

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

【问题讨论】:

  • 您是否尝试将@NonCPS 添加到您的函数中?
  • noncps 是做什么的?
  • 所以,我决定使用配置文件来实现idea-cli-inspector,所以现在我在这里描述了一个新问题:StackOverflow

标签: jenkins groovy jenkins-workflow jenkins-pipeline


【解决方案1】:

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

【讨论】:

  • new 没有出现在那里。
猜你喜欢
  • 2016-11-02
  • 2017-10-18
  • 2022-11-09
  • 1970-01-01
  • 2017-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多