Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: Access bitbucket payload in shell

According to the documentation of the bitbucket plugin for Jenkins (https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin) it should be possible to access the payload infos through the environment varaible $BITBUCKET_PAYLOAD. However when in my build I run the command printenv, there is no environment variable called $BITBUCKET_PAYLOAD, and nothing related to it. So it's impossible for me to access informations I need to configure my build.

like image 452
JimZer Avatar asked Jul 17 '16 23:07

JimZer


People also ask

Can we integrate Jenkins with bitbucket?

Jenkins successfully integrated with Bitbucket. Whenever a new code is committed in the BitBucket, the Jenkins job will automatically create a new build each time. We can test the same from the Bitbucket. Add a file to check the build is triggered when changes are applied in the Bitbucket.


1 Answers

You can trigger Jenkins with Generic Webhook Trigger instead.

Then you can create a variable everything having the JSONPath $. Then everything will resolve to the entire JSON payload. So you can have a shell script build step like:

echo $everything
like image 56
Tomas Bjerre Avatar answered Nov 15 '22 07:11

Tomas Bjerre