Issue
I have a multibranch job using a generic webhook and I want to access the JSON payload the Jenkins receives. I unfortunately cannot seem to access it, I cannot define parameters for the multibranch job and I am at a loss.
I would like to determine the cause of the trigger, whether it be from a pull request, a push, a commit, etc. Multibranch pipelines don't allow for me to specify any variables in Jenkins, so I'm a bit confused.
Solution
Configure a JSONPath
variable with the JSONPath $
and it will be resolved to the entire received JSON.
And to do this in a multibranch pipeline, your pipeline can look something like this:
properties([
pipelineTriggers([
[$class: 'GenericTrigger',
genericVariables: [
[key: 'everything', value: '$']
],
...
]
])
])
The readme has complete examples on how to use it with Multibranch.
Answered By - Tomas Bjerre
Answer Checked By - Clifford M. (JavaFixing Volunteer)