In my pipeline script, I get the error org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods drop java.util.List int
.
So far, so good. But when I go to the ScriptApproval page, there are no pending signature approvals.
The odd thing is that on a different Jenkins system, when I ran the same command, it added it to the pending script approvals, and I was able to use it just fine.
Is there a way to either
I have faced the similar problem, Jenkins did not add any static method to script approval page.
Think it was a some kind of bug with Jenkins and security plugin, because I have never met this behavior before. As workaround I had to manual execute the next script in "Script Console" page on https://JENKINS_URL/script
def scriptApproval = org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get()
scriptApproval.approveSignature("staticMethod jenkins.model.Jenkins getInstance")
scriptApproval.save()
I had the same, is your pipeline multibranch?
Mine was and I solved it by doing the following:
Add the method invocation 'org.codehaus.groovy.runtime.DefaultGroovyMethods drop' in another pipeline that is NON multibranched, if you dont have any just create a dummy one.
Run the pipeline, it will now appear under the script approval section.
Apparently this bug only affects multibranch pipelines.
Hope it can still be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With