Jenkins v2.126, Groovy plugin v2.0
I have the following in my Jenkinsfile, called from a Pipeline job.
def someFunction() {
Date today = new Date("yyyy-MM-dd")
// other statements
}
and I get the following exception.
ERROR: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new java.util.Date java.lang.String
According to Google searches, I should see something to approve in Manage Jenkins->In-process Script Approval, but I don't see anything there. NOTHING!
Additionally, there should a be a "Use Groovy Sandbox" check box in my job configuration page, but I do NOT see that either.
What am I missing?
try {
...
} catch (RejectedAccessException e) {
throw e
} catch (Exception e) {
echo "ERROR: " + e.message
}
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/265bb8d4-ce92-46c3-bb03-470819daf2b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WorkflowScript: 110: unable to resolve class RejectedAccessException@ line 110, column 5.
} catch (RejectedAccessException e) {
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:325)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
If your pipeline catches and discards the exception after printing, it will not appear in the Manage Jenkins place. Use something like this to avoid that:try {
...
} catch (RejectedAccessException e) {
throw e
} catch (Exception e) {
echo "ERROR: " + e.message
}
On Tue, Jun 12, 2018 at 10:24 AM, ZillaYT <zil...@gmail.com> wrote:
Jenkins v2.126, Groovy plugin v2.0
I have the following in my Jenkinsfile, called from a Pipeline job.
def someFunction() { Date today = new Date("yyyy-MM-dd") // other statements }and I get the following exception.
ERROR: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new java.util.Date java.lang.StringAccording to Google searches, I should see something to approve in Manage Jenkins->In-process Script Approval, but I don't see anything there. NOTHING!
Additionally, there should a be a "Use Groovy Sandbox" check box in my job configuration page, but I do NOT see that either.
What am I missing?
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/265bb8d4-ce92-46c3-bb03-470819daf2b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
try {
...
} catch (org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException e) {
throw e
} catch (Exception e) {
echo "ERROR: " + e.message
}If your pipeline catches and discards the exception after printing, it will not appear in the Manage Jenkins place. Use something like this to avoid that:try {
...
} catch (RejectedAccessException e) {
throw e
} catch (Exception e) {
echo "ERROR: " + e.message
}
On Tue, Jun 12, 2018 at 10:24 AM, ZillaYT <zil...@gmail.com> wrote:
Jenkins v2.126, Groovy plugin v2.0
I have the following in my Jenkinsfile, called from a Pipeline job.
def someFunction() { Date today = new Date("yyyy-MM-dd") // other statements }and I get the following exception.
ERROR: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new java.util.Date java.lang.StringAccording to Google searches, I should see something to approve in Manage Jenkins->In-process Script Approval, but I don't see anything there. NOTHING!
Additionally, there should a be a "Use Groovy Sandbox" check box in my job configuration page, but I do NOT see that either.
What am I missing?
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/265bb8d4-ce92-46c3-bb03-470819daf2b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b25fcff3-d598-4551-a2bd-f25e5f9f0d0e%40googlegroups.com.