I am trying to create a common shared library for the common steps used in my Jenkins scripts in multiple projects. I have a step sendBuildInfoSlack which earlier called a function defined in the same JenkinsFile. I moved it to its own step in a common shared library under vars folder.
The call function of this file is calling the same function that used to work directly in JenkinsFile. However, it is giving me this error:
Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.jenkinsci.plugins.workflow.cps.CpsClosure2 sendBuildInfoSlack java.util.LinkedHashMap). Administrators can decide whether to approve or reject this signature.
Error when executing failure post condition:
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.jenkinsci.plugins.workflow.cps.CpsClosure2 sendBuildInfoSlack java.util.LinkedHashMap)
I did not expect to run into this error, especially since while declaring Global Pipeline Libraries it explicitly says that These libraries will be trusted, meaning they run without sandbox restrictions
Also, it is not clear to me which method is causing this issue.
I would prefer if I did not have to whitelist every function since I expect this library to grow to cover more widely used functions and I do not have permission to whitelist either.
Any help please?
