Plugin Information |
---|
View Webhook Step on the plugin site for more information. |
It is already possible to wait for an external system to post using the input step plugin, but is more complex. To use `input`, an external system must authenticate to Jenkins, retrieve a Jenkins-Crumb for CSRF protection, then post data in an `input` specific format. This plugin uses unique tokens as an implicit form of authentication and accepts any content that is posted.
Usage
Using this plugin will usually require 3 steps:
- Register a webhook
- Start a long running task while providing the webhook url for callback
- Wait for the webhook to be executed
For example, the following pipeline script writes out the webhook url to the log and waits for a user to call it:
hook = registerWebhook() echo "Waiting for POST to ${hook.getURL()}" data = waitForWebhook hook echo "Webhook called with data: ${data}"
When this job is executed, something like the following log is printed:
Waiting for POST to http://localhost:8080/webhook-step/bef13807-a161-4193-ab95-6cb974afc71d
To continue the pipeline, we can post to this url. To do this with curl, execute curl -X POST -d 'OK'
http://localhost:8080/webhook-step/bef13807-a161-4193-ab95-6cb974afc71d
. Looking back at the Jenkins Job, it should now have completed and logged Webhook called with data: OK
.
Version History
Version 1.3 (October 2017)
- Minor bug fix release for HTTP Posts that do not include body size
Version 1.1 (March 2017)
- Relaxed versions of required dependencies
Version 1.0
- Initial Release