Reputation: 3
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.
Upvotes: 0
Views: 4301
Reputation: 1
You can access the payload by configuring build triggers in the configure section of the jenkins job.enter image description here
Upvotes: 0
Reputation: 3500
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.
Upvotes: 3