Get payload parameters in Jenkins

前端 未结 2 1539
野性不改
野性不改 2021-01-24 10:15

I\'m a newbie in Jenkins. I followed this help to implement Jenkins, Github and Webhook.

However, I\'m stuck in this problem. I want to get the payload parameters in Je

2条回答
  •  一生所求
    2021-01-24 10:42

    There are few steps that you should follow:

    1. Configure a web-hook in GitHub by which you will start communicating with Jenkins. This can be easily by going to your GitHub repository --> Setting --> Web-hooks.

    2. Make the entry for content-type as application/x-www-form-encoded.

    3. Select the event as Push event.
    4. Create a String parameter in Jenkins Server by the name of "payload".
    5. Following Step 3 GitHub would be able to wrap the content in this variable and send it to Jenkins.
    6. In Jenkins you can then read $payload variable when your build is kicked off.
    7. Parse the JSON using library of your choice

    References: How to process a github webhook payload in Jenkins? https://developer.github.com/webhooks/#payloads

提交回复
热议问题