Custom Webhook Governance
Implementing Webhook Based Custom Governance Controllers
Some enterprises require bespoke governance, either because they are not standardized on ServiceNow or because they use it in a unique, tailor-built way. Plural allows you to bridge that gap with a simple webhook-based protocol. Before implementing, it's worth briefly looking through the docs on PR governance to familiarize yourself with the model.
Info:
For this to work, it's assumed you have an SCM webhook configured to provide Plural with an event stream for pull requests/merge requests from your SCM provider. We support all major SCM providers, and webhooks are easy to set up at Self Service -> SCM Management. Most SCM providers also have ways to limit the scope of webhook events to individual repository sets in case it cannot be implemented organization-wide.
Defining a PrGovernance CRD
The webhook-based Governance CRD is relatively straightforward. Here's an example:
apiVersion: deployments.plural.sh/v1alpha1
kind: PrGovernance
metadata:
name: webhook
spec:
type: WEBHOOK
connectionRef:
name: governance # reference to the ScmConnection that is used for Pr approval
configuration:
webhook:
url: https://governance-webhook.acme.comInfo:
At the moment, this is only feasible on self-hosted instances of Plural.
From there, to tie it to a pull request, you'll need:
- An SCM webhook for the repository pointing to Plural (this can be created in Self Service -> SCM Management in your Plural Console instance).
- The
Plural governance: webhooktag in your PR description, so that we identify it as requiring governance.
Webhook Controller Implementation
The webhook expects three REST-like APIs to be present: