read:webhook:bitbucket and write:webhook:bitbucket scopes on the API token too; on Bitbucket Data Center, the Repository admin permission. If it didn’t happen, Repositories lists the repository with the reason, and you can set the webhook up manually:
Webhook URLs must reach the Webhooks service (port 3332). Using the API domain only works if your reverse proxy routes
/.../webhook paths to the webhooks service.Bitbucket Cloud
- Navigate to your Bitbucket repository
- Click on “Repository settings” in the left sidebar
- Select “Webhooks”
- Click “Add webhook”
-
Time to configure your webhook:
- Title: Kodus Code Review
- URL: The URL you put under
GLOBAL_BITBUCKET_CODE_MANAGEMENT_WEBHOOKin the.envfile (it ends with/bitbucket/webhook) - Status: Active
- SSL/TLS: Check Enable SSL verification
- Triggers: Select these events:
- Pull Request
- Created
- Updated
- Merged
- Declined
- Comment created
- Pull Request
- Click “Save”
Bitbucket Data Center
Bitbucket Data Center support is in alpha. Open the repository, go to Repository settings > Webhooks and create a webhook with:- URL: the same
GLOBAL_BITBUCKET_CODE_MANAGEMENT_WEBHOOKvalue - Events: the pull request events
pr:opened,pr:modified,pr:comment:added,pr:mergedandpr:declined
Kodus only consumes pull request events: on Cloud
created, updated, merged, declined and comment created, on Data Center the five listed above. Repository, Issue, and build-status triggers are discarded on arrival, so leaving them unchecked keeps the webhook traffic down. Automatic registration on Data Center also subscribes to pr:reviewer:updated, which Kodus receives and ignores.Pushes to an open pull request
On Data Center, a push of new commits to an open pull request arrives aspr:from_ref_updated. Kodus does not subscribe to it and discards it, so a push does not start a review. pr:modified fires when the title, description, target branch or draft state changes. Kodus ignores it unless the latest commit is new to Kodus or the pull request leaves draft. To review new commits, comment @kody start-review on the pull request.
On Cloud, Kodus handles pullrequest:updated the same way: it starts a review only when the latest commit is new to Kodus or the pull request leaves draft.