webhook

package
v0.148.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

Webhook Plugin

Send attestations and SBOMs to using webhooks.

How to use it

  1. To get started, you need to register the plugin in your Chainloop organization.
chainloop integration registered add webhook --name [my-registration] --opt url=[webhookURL]

Note: The webhook URL must be accessible from the Chainloop control plane.

  1. Attach the integration to your workflow.
chainloop integration attached add --workflow $WID --integration $IID

Note: You can specify the send_attestation and send_sbom options to control what is sent to the webhook. --opt "send_attestation=false" will disable sending attestations, and --opt "send_sbom=true" will enable sending SBOMs.

Registration Input Schema

Field Type Required Description
url string yes Webhook URL to send payloads to
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/chainloop-dev/chainloop/app/controlplane/plugins/core/webhook/v1/registration-request",
  "properties": {
    "url": {
      "type": "string",
      "minLength": 1,
      "description": "Webhook URL to send payloads to"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "url"
  ]
}

Attachment Input Schema

Field Type Required Description
send_attestation boolean no Send attestation
send_sbom boolean no Additionally send CycloneDX or SPDX Software Bill Of Materials (SBOM)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/chainloop-dev/chainloop/app/controlplane/plugins/core/webhook/v1/attachment-request",
  "properties": {
    "send_attestation": {
      "type": "boolean",
      "description": "Send attestation",
      "default": true
    },
    "send_sbom": {
      "type": "boolean",
      "description": "Additionally send CycloneDX or SPDX Software Bill Of Materials (SBOM)",
      "default": false
    }
  },
  "additionalProperties": false,
  "type": "object"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(l log.Logger) (sdk.FanOut, error)

New initializes the webhook integration

Types

type Integration

type Integration struct {
	*sdk.FanOutIntegration
	// contains filtered or unexported fields
}

Integration implements a generic webhook integration

func (*Integration) Attach

func (i *Integration) Attach(_ context.Context, req *sdk.AttachmentRequest) (*sdk.AttachmentResponse, error)

Attach is executed when attaching the webhook integration to a workflow

func (*Integration) Execute

func (i *Integration) Execute(ctx context.Context, req *sdk.ExecutionRequest) error

Execute is called when an attestation or SBOM is received

func (*Integration) Register

func (i *Integration) Register(ctx context.Context, req *sdk.RegistrationRequest) (*sdk.RegistrationResponse, error)

Register is executed when registering the webhook integration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL