YAML Schema
resources: - name: <string> type: OutgoingWebhook configuration: webhookName: <string> # name of an Outgoing Webhook Integration method: <GET|PUT|POST|DELETE|PATCH> # default POST Parameters: <string> # query string to be appended to the outgoing URL path: <string> headers: Content-type: <valid request content types> accept: xyc
Tags
name
An alphanumeric string (underscores are permitted) that identifies the resource.
type
Must be OutgoingWebhook
for this resource type.
configuration
Specifies all configuration selections for the resource.
Tag | Description | Required/Optional |
---|---|---|
webhookName | The name of an Outgoing Webhook Integration | Required |
method | The HTTP method to use: GET | PUT | POST | DELETE | PATCH The default is POST. | Optional |
Parameters | A query string to be appended to the outgoing URL | Optional |
path | Path for the outgoing URL | Optional |
headers | Any HTTP entity headers to include. For example, content-type to specify any the type of content returned. | Optional |
Environment Variables
Whenever Webhook
is used in a step, a set of environment variables is automatically made available that you can use in your step.
Environment Variable | Description |
---|---|
| Name of the resource |
res_<resource_name>_payload | The JSON payload attached to the resource |
res_<resource_name>_skipWebhook | When set to true, the outgoing webhook will not be sent. This is useful to inhibit sending of a prepared webhook in a step's Defaults to false. |
Examples
The Pipelines DSL for this example is available in this repository in the JFrog GitHub account.
Example 1
resources: - name: My_OutHook_formurl_Resource type: OutgoingWebhook configuration: webhookName: My_OutgoingWebhookIntegration path: /url headers: content-type: application/x-www-form-urlencoded pipelines: - name: ExamplePipeline steps: - name: my_send_hook_formurl type: Bash configuration: outputResources: - name: My_OutHook_formurl_Resource execution: onExecute: - echo "hello world" - formUrlEncodedPayload="foo=bar&runNumber=$run_number&stepName=$step_name" - set_payload My_OutHook_formurl_Resource "$formUrlEncodedPayload"
Example 2
resources: - name: MyOutgoingJSONResource type: OutgoingWebhook configuration: webhookName: MyOutgoingJSONResource path: /json pipelines: - name: ExamplePipeline steps: - name: my_send_hook_json type: Bash configuration: outputResources: - name: MyOutgoingJSONResource execution: onExecute: - jsonPayload="{\"runNumber\":\"$run_number\", \"stepName\":\"$step_name\"}" - set_payload MyOutgoingJSONResource "$jsonPayload" onFailure: - export res_MyOutgoingJSONResource_skipWebHook=true onSuccess: - echo "Payload sent by "$res_MyOutgoingJSONResource_name":" - echo $res_MyOutgoingJSONResource_payload