沙箱阻止我格式化字符串 [英] Sandbox is preventing me from formatting a string
问题描述
node(master)
{
echo 我即将尝试使用String.format
def jjj = String.format(bob)
echo jjj
}
如果我将这个脚本放入我的作业配置并运行它,它运行良好。
但是,如果我将该脚本放入一个文件中,然后通过SCM的工作流脚本加载,我会收到错误消息。
org .jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:未分类的staticMethod java.lang.String格式java.lang.String
我该如何解决这个问题?是否有可能关闭工作流脚本从SCM的沙箱,就像它是工作流脚本?
或者有一些沙箱批准的格式化字符串在groovy?
为什么它阻止我格式化字符串在第一位?
然而,您可以批准这里的用法:
http://< jenkins_host>:< port> / scriptApproval /
I have a simple groovy script:
node ("master")
{
echo "I am about to try to use String.format"
def jjj = String.format("bob")
echo jjj
}
If I put this script right into my job configuration and run it, it runs fine.
But if I put that script into a file which I then load via "Workflow script from SCM", I get the error
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod java.lang.String format java.lang.String
How do I work around this? Is it possible to turn off the sandbox for "Workflow script from SCM" like it is for "Workflow script"?
Or is there some sandbox-approved way of formatting a string in groovy?
And why is it preventing me from formatting a string in the first place?
I think it's not possible to disable sandboxing when using Workflow script from SCM
However you can approve the usage here:
http://<jenkins_host>:<port>/scriptApproval/
这篇关于沙箱阻止我格式化字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!