An IncomingWebhook
resource can trigger one or more jobs in your pipeline whenever the associated URL is called using the HTTP POST method.
When an IncomingWebhook
resource is created with an Incoming Webhook Integration, it can be specified as an input to any step in that step's inputResources
section. By default, any incoming payload from the webhook will trigger execution of the step, but this can be changed by setting trigger
to false
.
Any JSON payload passed in by the received POST call is stored in the payload
property of the resource.The step can access the JSON payload through the res_<resource_name>_payload
environment variable. The value of the environment variable can be written to a file, and individual elements can be read from that file using the read_json utility function.
When using Webhook as an output resource, you can construct the outgoing payload through the write_output utility function to add key/value pairs.
You can use an IncomingWebhook
resource to trigger execution of another pipeline. When specified as an output resource of a step in one pipeline and an input resource of a step in a different pipeline, setting a payload for the IncomingWebhook
in the first step will trigger execution of the other step. In this way, completion of a step in one pipeline can trigger execution of a different pipeline.
Incoming Webhooks and Multi Branch Pipelines
When working with Multi Branch Pipelines, to trigger an IncomingWebhook
resource for a specific Pipelines Source branch, you need to add the branch query parameter to your Incoming Webhook URL as follows:
http://host:port/pipelines/api/v1/projectIntegrations/1/hook?branch=>
Example
http://host:port/pipelines/api/v1/projectIntegrations/1/hook?branch=foo
Additional resources for IncomingWebhook integration include: