System hooks
Configuring system hooks¶
Entries in gitlab_settings_instance.system_hooks are reconciled with full
lifecycle semantics: created when missing, updated when drifted, and removed
with state: absent. The same hook schema applies to hooks lists under
group and project
entries.
Hook identity
A hook's identity is an explicit server-assigned id when supplied,
otherwise its name when present, otherwise its url. GitLab permits
duplicate names and URLs, so use id to address one existing duplicate.
An id is lookup-only and cannot create a hook. Without an ID, give hooks
stable names: renaming one changes its identity and creates a new hook
rather than updating the old one.
Example system hook definition¶
gitlab_settings_instance:
system_hooks:
- name: audit-forwarder
url: https://hooks.example.com/gitlab/system
token: "{{ vault_gitlab_system_hook_token }}"
push_events: true
merge_requests_events: true
repository_update_events: true
enable_ssl_verification: true
url_variables:
tenant: fde
custom_headers:
X-GitLab-Environment: lab
state: present
System Hook Spec¶
GitLab API reference
GitLab's API documentation defines the hook fields and event toggles:
|
Optional server-assigned lookup identity for one existing hook, particularly when names or URLs are duplicated. Lookup-only: omit it when creating a hook. | Example: |
|
Hook display name and preferred identity. When | Example: |
|
Endpoint the hook posts to. Used as the identity when | Example: |
|
Lifecycle of the hook. Can be one of: Default: | Example: |
|
Shared secret sent with hook deliveries. Write-only: GitLab never returns it, so it is never drift-compared; it is carried on every write, and | Example: |
|
Payload signing secret. Same write-only and secrecy semantics as | Example: |
|
Rewrite Default: | Example: |
|
Human-readable hook description. | Scopes: system, group, project |
|
Verify the destination's TLS certificate when delivering the hook. | Scopes: system, group, project |
|
Deliver the hook for repository push events. | Scopes: system, group, project |
|
Restrict push-event deliveries to branches matching this filter. | Scopes: system, group, project |
|
How | Scopes: system, group, project |
|
Deliver the hook when tags are pushed. | Scopes: system, group, project |
|
Deliver the hook for merge-request events. | Scopes: system, group, project |
|
Custom template used to construct the webhook request payload. | Scopes: system, group, project |
|
Deliver the hook when a repository is updated. | Scope: system |
|
Deliver the hook for issue events. | Scopes: group, project |
|
Deliver the hook for confidential-issue events. | Scopes: group, project |
|
Deliver the hook for note and comment events. | Scopes: group, project |
|
Deliver the hook for confidential-note events. | Scopes: group, project |
|
Deliver the hook for CI/CD job events. | Scopes: group, project |
|
Deliver the hook for pipeline events. | Scopes: group, project |
|
Deliver the hook for wiki-page events. | Scopes: group, project |
|
Deliver the hook for deployment events. | Scopes: group, project |
|
Deliver the hook for feature-flag events. | Scopes: group, project |
|
Deliver the hook for release events. | Scopes: group, project |
|
Deliver the hook for milestone events. | Scopes: group, project |
|
Deliver the hook for award-emoji events. | Scopes: group, project |
|
Deliver the hook for group or project access-token expiry events. | Scopes: group, project |
|
Deliver the hook for vulnerability events. | Scopes: group, project |
|
Deliver the group hook when projects are created, updated, transferred, or deleted. | Scope: group |
|
Deliver the group hook for subgroup events. | Scope: group |
|
Deliver the group hook for membership events. | Scope: group |
|
Deliver the project hook for deploy-token expiry events. | Scope: project |
|
Hook URL variables. Write-only children: GitLab masks the values in responses, so reconciliation is by key presence — a listed key is treated as in sync, and value drift is not detectable. Properties of
| Example: |
|
Custom HTTP headers sent with deliveries. Values have the same write-only presence semantics as Properties of
| Example: |