Link Search Menu Expand Document

Webhooks

A Webhook is a Hook type that sends an HTTP POST request to the configured URL. Any non 2XX response by the responding endpoint will fail the Hook, cancel the execution of the following Hooks under the same Action. For pre-* hooks, the triggering operation will also be aborted.

Warning: You should not use pre-* webhooks for long-running tasks, since they block the performed operation. Moreover, the branch is locked during the execution of pre-* hooks, so the webhook server cannot perform any write operations on the branch (like uploading or commits).

Action File Webhook properties

See the Action configuration for overall configuration schema and details.

Property Description Data Type Required Default Value Env Vars Support
url The URL address of the request String true   no
timeout Time to wait for response before failing the hook String (golang’s Duration representation) false 1 minute no
query_params List of query params that will be added to the request Dictionary(String:String or String:List(String) false   yes
headers Headers to add to the request Dictionary(String:String) false   yes

Secrets & Environment Variables
lakeFS Actions supports secrets by using environment variables. The format {{ ENV.SOME_ENV_VAR }} will be replaced with the value of $SOME_ENV_VAR during the execution of the action. If that environment variable doesn’t exist in the lakeFS server environment, the action run will fail.

All environment variables need to begin with “LAKEFSACTIONS_”. Otherwise, they will be blocked. Additionally, the actions.env.enabled configuration parameter can be set to false to block access to all environment variables.

Example:

...
hooks:
  - id: prevent_user_columns
    type: webhook
    description: Ensure no user_* columns under public/
    properties:
      url: "http://<host:port>/webhooks/schema"
      timeout: 1m30s
      query_params:
        disallow: ["user_", "private_"]
        prefix: public/
      headers:
        secret_header: "{{ ENV.MY_SECRET }}"
...

Request body schema

Upon execution, a webhook will send a request containing a JSON object with the following fields:

Field Description Type
event_type Type of the event that triggered the Action string
event_time Time of the event that triggered the Action (RFC3339 formatted) string
action_name Containing Hook Action’s Name string
hook_id ID of the Hook string
repository_id ID of the Repository string
branch_id1 ID of the Branch string
source_ref Reference to the source on which the event was triggered string
commit_message2 The message for the commit (or merge) that is taking place string
committer2 Name of the committer string
commit_metadata2 The metadata for the commit that is taking place string
tag_id3 The ID of the created/deleted tag string

Example:

{
  "event_type": "pre-merge",
  "event_time": "2021-02-28T14:03:31Z",
  "action_name": "test action",
  "hook_id": "prevent_user_columns",
  "repository_id": "repo1",
  "branch_id": "feature-1",
  "source_ref": "feature-1",
  "commit_message": "merge commit message",
  "committer": "committer",
  "commit_metadata": {
    "key": "value"
  }
}
  1. N\A for Tag events 

  2. N\A for Tag and Create/Delete Branch events  2 3

  3. Applicable only for Tag events