Skip to content
Available onCommunityCloudPro

GitLab WebHook Integration

Collect GitLab events (via webhooks), transform them to cdevents.

  • GitLab tracks all changes to repositories, issues, merge requests, releases, pipelines, jobs, and more. And it notifies a webhook about these changes.
  • cdviz-collector transforms these events to cdevents, and sends them to the database, listeners,...

From eventCDEvents
release.createdartifact.published
tag_pushartifact.published
push (branch)branch.{created, deleted}
merge_request.open/reopenchange.created
merge_request.mergechange.merged
merge_request.closechange.abandoned
merge_request.approvedchange.reviewed
merge_request.updatechange.updated
pipeline.created/pendingpipelineRun.queued
pipeline.runningpipelineRun.started
pipeline.success/failedpipelineRun.finished
build.runningtaskRun.started
build.success/failedtaskRun.finished
issue.open/reopenticket.created
issue.closeticket.closed
issue.updateticket.updated

Configuration ​

CDviz Side ​

Configure cdviz-collector.toml to receive GitLab webhook events:

toml
[sources.gitlab_webhook]
enabled = true
transformer_refs = ["gitlab_events"]

[sources.gitlab_webhook.extractor]
type = "webhook"
id = "000-gitlab" # used as part of the webhook's url
headers_to_keep = ["X-Gitlab-Event"]

[sources.gitlab_webhook.extractor.headers]
# value set by env CDVIZ_COLLECTOR__SOURCES__GITLAB_WEBHOOK__EXTRACTOR__HEADERS__X-GITLAB-TOKEN__VALUE
"x-gitlab-token" = { type = "equals", value = "xxx", case_sensitive = true }

# Transformer from transformers-community repository
[remote.transformers-community]
type = "github://cdviz-dev/transformers-community"
# token = "xxx"  # set by env 'CDVIZ_COLLECTOR__REMOTE__TRANSFORMERS-COMMUNITY'

[transformers]
gitlab_events = { type = "vrl", template_rfile = "transformers-community:///gitlab_webhook/transformer.vrl" }

Replace "token-changeme" with your actual secret token configured in GitLab webhook settings.

The template_rfile references the VRL transformation logic from the transformers-community repository. For more details on remote transformers, see the Transformers documentation.

The webhook endpoint to declare on GitLab's side is then http://your-collector-url/webhook/000-gitlab.

Testing the access to the webhook ​

Make an empty POST to the endpoint, it should be rejected with HTTP status 400.