I've got a Jenkins pipeline job; it is configured to build on remote trigger which is being called by a BitBucket webhook. This works and is triggering the build.
I also need to access the payload data sent by BitBucket (described here) to get details about the push such as the specific branch.
The BitBucket plugin would usually parse this payload and present it to the job as an environment variable, but I can't set the pipeline job as being connected to a specific repo for that plugin, so it doesn't help.
I tried testing to see if the data was available in a few different ways like so:
node {
stage 'Desperation'
echo "${params.push}"
echo "${env.BITBUCKET_PAYLOAD}"
echo "${env.push}"
}
These don't work (nor did I really expect them to).
Is there any way to get hold of this payload data? The only thing I can come up with is having a freestyle job and setting up the connection to BitBucket on that, then calling this job afterwards with the data reformatted. That seems horribly clunky though.