title | sidebar_label | description | sidebar_position |
---|---|---|---|
Use Self-Hosted CodeRabbit With Azure DevOps |
Azure DevOps |
Instructions to self-host CodeRabbit and integrate it with Azure DevOps. |
3 |
- Username: Set the username to "CodeRabbit" for easier identification (optional).
- Profile Image: Use the CodeRabbitAI logo for the user image (optional).
Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with rights to post reviews & open PRs.
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 manage
Consult official CodeRabbitAI documentation for a detailed guide on creating personal access tokens.
-
Navigate to project's Service Hooks Page: Go to the service hooks configuration page in the desired Azure DevOps project.
-
Add the following webhooks:
- Pull request created
- Pull request updated
- Pull request commented on
-
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.
Create an .env
file with the following content:
# if using OpenAI
LLM_PROVIDER=openai
LLM_TIMEOUT=360000
OPENAI_API_KEYS=<openai-key>
OPENAI_BASE_URL=[<openai-base-url>]
OPENAI_ORG_ID=[<openai-org-id>]
OPENAI_PROJECT_ID=[<openai-project-id>]
# if using Azure OpenAI
LLM_PROVIDER=azure-openai
LLM_TIMEOUT=360000
AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint>
AZURE_OPENAI_API_KEY=<key>
AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name>
AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06>
## o1-mini is optional
AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>]
## o1-preview is optional: it’s very expensive but provides best reviews
AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>]
## gpt-4-turbo is optional: it’s expensive but provides better reviews than gpt-4o
AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>]
TEMP_PATH=/cache
AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules
AST_GREP_ESSENTIALS=ast-grep-essentials
SELF_HOSTED=azure-devops
AZURE_DEVOPS_BOT_TOKEN=<personal-access-token>
AZURE_DEVOPS_BOT_USERNAME=<bot-user-username>
CODERABBIT_LICENSE_KEY=<license-key>
CODERABBIT_API_KEY=[<coderabbitai-api-key>]
ENABLE_LEARNINGS=[true]
ENABLE_METRICS=[true]
JIRA_HOST=[<jira-host-url>]
JIRA_PAT=[<jira-personal-access-token>]
LINEAR_PAT=[<linear-personal-access-token>]
:::note
- 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.
:::
Authenticate and pull the Docker image using the provided credentials file:
cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev
docker pull <docker-registry>/coderabbit-agent:latest
You can query /health
endpoint to verify that the coderabbit-agent service is up and running.
curl 127.0.0.1:8080/health
You can host the image on a server, serverless function, or container environment and expose port 8080
. 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:
docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest