简体   繁体   中英

Accessing the BitBucket webhook's payload in Jenkins jobs

I'm using webhooks on Bitbucket to trigger builds on Jenkins when push event occurs, for this purpose I'm using Bitbucket plugin. My Jenkins pipeline consist of multiple cross depending tasks eg:

Main pipeline (triggered task)

      1) build docker images
      2) run tests
      3) do something

The build is triggered when expected but tasks are failing because they rely on specific branch that I need to provide. Unfortunately I don't know how to access the webhook's payload that have all the information I need.

The alternative would be using Poll CMS option in Jenkins but I prefer to build on demand and not periodically.

From:

https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin

they say:

Since 1.1.5 Bitbucket automatically injects the payload received by Bitbucket into the build. You can catch the payload to process it accordingly through the environmental variable $BITBUCKET_PAYLOAD.

Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM