The self-hosted option is only available for CodeRabbit Enterprise customers with 500 user seats or more. Please contact CodeRabbit Sales to learn more about the CodeRabbit Enterprise plan.
Create an Azure DevOps User
- Username: Set the username to “CodeRabbit” for easier identification (optional).
- Profile Image: Use the CodeRabbitAI logo for the user image (optional).
The user installing CodeRabbit must have either of the following permissions:
Project Administrator
Project Collection Administrator
Add User to Projects
Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with rights to post reviews & open PRs.Create a Personal Access Token for CodeRabbit user
Generate a personal access token for the CodeRabbit user to be added in the.env
file as AZURE_DEVOPS_BOT_TOKEN
.
Necessary Scopes:
Code
- FullWork Items
- Read, write, and manageBuild
- Read
Add the necessary webhooks to each project
1
Navigate to project's Service Hooks Page
Go to the service hooks configuration page in the desired Azure DevOps project.
2
Add the following webhooks
Create service hooks for these events:
- Pull request created
- Pull request updated
- Pull request commented on
3
Add Webhook URL
Enter the URL pointing to the CodeRabbit service, followed by
/azure_webhooks
(e.g., http://127.0.0.1:8080/azure_webhooks
) for each webhook.Prepare an .env
file
Create an .env
file with the following content:
.env
- If you are using Azure OpenAI, verify that the model deployment names are in the .env file.
- Values marked with [] are not optional to provide.
- You can generate
CODERABBIT_API_KEY
from CodeRabbit UI -> Organizations Settings -> API Keys. YAML_CONFIG
is an optional configuration file that can be used to customize CodeRabbit’s behavior at the deployment level. It takes the same format as the CodeRabbit YAML configuration file. It requires the entire YAML file to be in an escaped string format, for example,YAML_CONFIG="key1: value1\nkey2: value2"
. You can use Escape YAML to generate the escaped string.
Pull the CodeRabbit Docker image
Authenticate and pull the Docker image using the provided credentials file:Verify the image is up
You can query/health
endpoint to verify that the coderabbit-agent
service is up and running.
Host the image
You can host the image on a server, serverless function, or container environment and expose port8080
. Run the Docker image with the equivalent command on your chosen platform, ensuring you replace the .env
file path with the path to your actual .env
file: