Accessing the BitBucket webhook's payload in Jenkins jobs

不打扰是莪最后的温柔 提交于 2020-03-21 18:06:19

问题


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 e.g.:

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.


    回答1:


    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



    来源:https://stackoverflow.com/questions/33548769/accessing-the-bitbucket-webhooks-payload-in-jenkins-jobs

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!