-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
As pointed out in the pipeline examples (https://jenkins.io/doc/pipeline/examples/#get-build-cause), there is no native way to retrieve the build trigger cause and therefore it is suggested to get it by using the `currentBuild.rawBuild` variable:
// Get all Causes for the current build
def causes = currentBuild.rawBuild.getCauses()
However the SCM scripts are not permitted to use the getRawBuild method, as shown bellow:
Error getting build cause: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild
Can you please consider to change the referred method to whitelisted method.
- duplicates
-
JENKINS-54227 Safely expose the Cause(s) associated with the current build
- Resolved
-
JENKINS-41272 Pipeline "currentBuild" should expose build causes
- Resolved
- links to