Script Security插件使用笔记
Script Security插件使用笔记
欢迎关注github: https://github.com/yexia553/Jenkins_Manual
script security插件主要的功能就是限制普通用户执行的grovvy脚本的一些方法,起到了一个安全控制的作用。
链接: https://plugins.jenkins.io/script-security/
但是在普通用户第一次运行grovvy脚本的时候会因为没有权限而报错,类似下面这样,报错的重点在第一行,很明确第说明了是由于script security插件导致的RejectedAccessException,具体的被拒绝的方法是Executor
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method hudson.model.Executor interrupt hudson.model.Resultat org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:265)at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:161)at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)......
可以通过加白名单的方式处理这种问题。详细见链接 https://medium.com/dronzebot/jenkins-groovy-script-approval-eff569f597f6
以下是简要说明
This is a basic issue with cloudbees and the pipeline scripts being hamstrung by the security plugin. To fix it you will need to add the blocked method to the whitelist. To get there do the following:
Manage Jenkins->In Process Script Approval


It will then inform you that there is a script that is awaiting approval, you can just click the button
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
