Skip to end of metadata
Go to start of metadata

Plugin Information

View Webhook Step on the plugin site for more information.

This pipeline plugin provides an easy way to block a build pipeline until an external system posts to a webhook. This can be used to integrate long running tasks into a pipeline, without busy waiting.

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:

  1. Register a webhook
  2. Start a long running task while providing the webhook url for callback
  3. 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

1 Comment

  1. Thanks for this plugin, it's very useful.

    However I've found a bug when reading a payload larger than the buffer (1024 bytes) and sent a small pull request to fix it:
    https://github.com/jenkinsci/webhook-step-plugin/pull/6

    It would be great to have this merged and a new version of the plugin released with this fix.  Or let me know if this should be fixed differently.

    Thanks!

    Best wishes,
    Guillaume