diff --git a/docs/self-hosted/gitlab.md b/docs/self-hosted/gitlab.md index 2488cfa0..395d93fc 100644 --- a/docs/self-hosted/gitlab.md +++ b/docs/self-hosted/gitlab.md @@ -37,19 +37,25 @@ Consult official CodeRabbitAI documentation for a detailed [guide](https://docs. 1. **Navigate to Add Webhook Page**: Go to the webhook configuration page in the desired GitLab project. 2. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/gitlab_webhooks` (e.g., `http://127.0.0.1:8080/gitlab_webhooks`). 3. **Generate and Save Secret Token**: Generate a secret token, add it to the webhook, and store it securely. This will be needed for the `.env` file as `GITLAB_WEBHOOK_SECRET` (you can use a single secret token for all projects). -4. Select triggers: +4. **Select triggers**: - Push events - Comments - Issues events - Merge request events -We have a convenient [script](/code/gitlab-webhook.sh) to help you add webhooks to all projects in a GitLab instance. You can run it with the following command: +## Add Webhook Using a Script + +We have a convenient [script](/code/gitlab-webhook.sh) to help you add webhooks to a project or all projects under a group in a GitLab instance. ```bash # Make sure the script is executable: chmod +x gitlab-webhook.sh +``` +Example usage: + +```bash # PAT example (header auto-detected) export GITLAB_TOKEN="glpat-xxxxx" ./gitlab-add-webhook.sh \ diff --git a/static/code/gitlab-webhook.sh b/static/code/gitlab-webhook.sh index b217079e..1458ba0d 100644 --- a/static/code/gitlab-webhook.sh +++ b/static/code/gitlab-webhook.sh @@ -7,13 +7,13 @@ # Make sure the script is executable: # chmod +x gitlab-webhook.sh -# PAT example (header auto-detected) +# PAT auto-detected header # export GITLAB_TOKEN="glpat-xxxxx" # ./gitlab-add-webhook.sh \ # -h "gitlab.example.com" -u "https://ci.example.com/gitlab-hook" \ # -s "mySecret" -p 42 -# PAT example (explicit header) +# PAT with explicit header # ./gitlab-add-webhook.sh \ # -h "gitlab.example.com" -u "https://ci.example.com/gitlab-hook" \ # -s "mySecret" -g "mygroup/mysubgroup/myproject" \