OutgoingWebhook Examples

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

The Pipelines DSL for this example is available in this repository in the JFrog GitHub 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