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







Overview

AnOutgoingWebhookresource uses HTTP to send information from a step to an external API endpoint through anOutgoing Webhook Integration.


When anOutgoingWebhook resourceisspecified as an outputResource for a step and has an attached payload (including an empty payload), at the completion of the step's execution, the payload is sent to the endpoint specified in theOutgoing Webhook Integration. If required, this can be overridden by setting the resource'sskipWebhookenvironment variable astrue .

To attach the outgoing payload, use theset_payload utilityfunction. If no payload is attached, no message is sent through the webhook.

Page Contents


YAML Schema

resources: - name:  type: OutgoingWebhook configuration: webhookName:  # name of an Outgoing Webhook Integration method:  # default POST Parameters:  # query string to be appended to the outgoing URL path:  headers: Content-type:  accept: xyc

Tags

name

Analphanumericstring (underscores are permitted) that identifies the resource.

type

Must beOutgoingWebhookfor this resource type.

configuration

Specifies all configuration selections for the resource.

Tag

Description

Required/Optional
webhookName The name of anOutgoing Webhook Integration Required
method

所使用的HTTP方法:| | |后删除| 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-typeto specify any the type of content returned. Optional

Environment Variables

WheneverWebhookis 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 The JSON payload attached to the resource
res__skipWebhook

When set totrue, the outgoing webhook will not be sent. This is useful to inhibit sending of a prepared webhook in a step'sonFailuresection.

Defaults tofalse.


Examples

The Pipelines DSL for this example is available inthis repositoryin theJFrogGitHub account.

Example 1

Outgoing Form URL Webhook
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

Outgoing JSON Webhook
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
  • No labels
Copyright © 2023 JFrog Ltd.