Skip to content

External hooks support for notifying or validating changeset #824

@Yshayy

Description

@Yshayy

Tweek publishing service is responsible for handling new git changes and publishing it to relevant services.

These mechanisms can be more generalized as:

  1. Validation - check key payload is valid (format, compilation), check for circular dependencies between keys.
  2. Publishing - bundle and upload keys and policies.

It can be useful to add support for running client code to support custom validation or integration with external keys.

For example, a team can create hook that allow changes to a specific key only in a specific time, or apply logic that enforce acknowledgement from external system when trying to open a specific feature flag.
Another example, is that when changing a key that has value of a url or external resource, an hook can check that this resource exist to prevent human errors and there are many other examples as well.

There are also the cases that a team want to be notified when there's a change to one of their keys, maybe in email, slack or similar tool.

We can investigate adding these types of hooks:

  • ValidationHook -> run as part of validating a new change-set, can be invoked with the relevant changes, and can reject a change-set by returning an error code.
  • NotificationHook -> run after validation, notifies a url with change-set details.
  • MutationHook (?) -> probably should be done after the others or not at all since it can be dangerous, but the idea is the create a webhook that can mutate the changeset. (for example, adding meta data, formatting)

All hooks can be defined to only run on specific paths/changes. (we can use wild cards), for example:

| Path                         | Type         |  url 
|  *                           | notification |  http://some-external-service/hook1
|  manifests/path/to/key       | validation   |  http://some-external-service/hook2
|  implementations/*/module    | validation   |  http://some-external-service/hook3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions