Cloud customer?
Start for Free>
Upgrade in MyJFrog >
What's New in Cloud >





Overview

AnIncomingWebhookresource cantrigger one or more jobs in your pipeline whenever the associated URL is called using the HTTP POST method.


When anIncomingWebhookresource is created with anIncoming Webhook Integration, it can be specified as an input to any step in that step's inputResourcessection. By default, any incoming payload from the webhook will trigger execution of the step, but this can be changed by settingtriggertofalse.

任何接收JSON载荷传递进来的d POST call is stored in thepayloadproperty of the resource.The step can access the JSON payload through theres__payloadenvironment variable. The value of the environment variable can be written to a file, and individual elements can be read from that file using theread_jsonutility function.

When using Webhook as an output resource, you can construct the outgoing payload through thewrite_outpututility function to add key/value pairs.

You can use anIncomingWebhookresource to trigger execution of another pipeline. Whenspecified 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 theIncomingWebhookin 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 withMulti Branch Pipelines, to trigger anIncomingWebhookresource for a specific Pipelines Source branch, you need to add thebranchquery parameter to yourIncoming Webhook URLas follows:
http://host:port/pipelines/api/v1/projectIntegrations/1/hook?branch=>

Example

http://host:port/pipelines/api/v1/projectIntegrations/1/hook?branch=foo

Page Contents


YAML Schema

resources: - name:  type: IncomingWebhook configuration: webhookName: 

Tags

name

Analphanumericstring (underscores are permitted) that identifies the resource.

type

Must beIncomingWebhookfor this resource type.

configuration

Specifies all configuration selections for the resource.

Tag

Description

Required/Optional
webhookName The name of anIncoming Webhook Integration Required

Environment Variables

WheneverIncomingWebhookis used in a step, a set of environment variables is automatically made available that you can use in your step.

Environment Variable

Description

res__name
Name of the resource
res__payload

Webhook payload that was received in the incoming POST or created by the step for output


Example

resources: - name: MyIncomingWebhookResource type: IncomingWebhook configuration: webhookName: MyIncomingWebhookIntegration pipelines: - name: ExamplePipeline steps: - name: ExampleStep type: Bash configuration: inputResources: - name: MyIncomingWebhookResource execution: onExecute: - echo "$res_MyIncomingWebhookResource_payload" | jq '.' > payload.json - read_json payload.json "LESSER_SECRET_FORMULA"
  • No labels
Copyright © 2022 JFrog Ltd.