From 4ebcc0c6d01fc9d7f815b188beb998e19886b408 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Dec 2024 10:00:30 -0500 Subject: [PATCH 1/8] add bitbucket docs --- docs/self-hosted/bitbucket.md | 114 ++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 docs/self-hosted/bitbucket.md diff --git a/docs/self-hosted/bitbucket.md b/docs/self-hosted/bitbucket.md new file mode 100644 index 00000000..ee57ea07 --- /dev/null +++ b/docs/self-hosted/bitbucket.md @@ -0,0 +1,114 @@ +--- +title: Use Self-Hosted CodeRabbit With Bitbucket Server +sidebar_label: Bitbucket Server +description: Instructions to self-host CodeRabbit and integrate it with Bitbucket Server. +sidebar_position: 4 +--- + +:::note + +The self-hosted option is only available for CodeRabbit Enterprise customers with 500 user seats or more. Please contact [CodeRabbit Sales](mailto:sales@coderabbit.ai) to learn more about the CodeRabbit Enterprise plan. + +::: + +## Create a Bitbucket User + +- **Username**: Set the username to "CodeRabbit" for easier identification (optional). +- **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). + +## Add User to Projects + +Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with permissions to: + +- Post reviews +- Open pull requests + +## 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 `BITBUCKET_SERVER_BOT_TOKEN`. + +## Add a webhook to each project + +1. **Navigate to Webhook Settings**: Go to the repository settings and locate the webhooks configuration page. +2. **Configure Events**: Enable the following Pull Request events: + - "Opened" + - "Modified" + - "Comment Added" +3. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/bitbucket_server_webhooks` (e.g., `http://127.0.0.1:8080/bitbucket_server_webhooks`). + +## Prepare an `.env` file + +Create an `.env` file with the following content: + +```bash +# if using OpenAI +LLM_PROVIDER=openai +LLM_TIMEOUT=360000 +OPENAI_API_KEYS= +OPENAI_BASE_URL=[] +OPENAI_ORG_ID=[] +OPENAI_PROJECT_ID=[] + +# if using Azure OpenAI +LLM_PROVIDER=azure-openai +LLM_TIMEOUT=360000 +AZURE_OPENAI_ENDPOINT= +AZURE_OPENAI_API_KEY= +AZURE_GPT4OMINI_DEPLOYMENT_NAME= +AZURE_GPT4O_DEPLOYMENT_NAME= # modelVersion: 2024-08-06 +AZURE_O1_MINI_DEPLOYMENT_NAME=[] # Optional +AZURE_O1_DEPLOYMENT_NAME=[] # Optional: Provides best reviews but very expensive +AZURE_GPT4TURBO_DEPLOYMENT_NAME=[] # Optional: modelVersion: turbo-2024-04-09 + +# System Configuration +TEMP_PATH=/cache +AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules +AST_GREP_ESSENTIALS=ast-grep-essentials +SELF_HOSTED=bitbucket-server +BITBUCKET_SERVER_URL=/rest +BITBUCKET_SERVER_WEBHOOK_SECRET= +BITBUCKET_SERVER_BOT_TOKEN= +BITBUCKET_SERVER_BOT_USERNAME= +CODERABBIT_LICENSE_KEY= +CODERABBIT_API_KEY=[] + +# Optional Features +ENABLE_LEARNINGS=[true] +ENABLE_METRICS=[true] +JIRA_HOST=[] +JIRA_PAT=[] +LINEAR_PAT=[] +``` + +:::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. + +::: + +## Pull the CodeRabbit Docker image + +Authenticate and pull the Docker image using the provided credentials file: + +```bash +cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev +docker pull us-docker.pkg.dev/coderabbitprod/self-hosted/coderabbit-agent:latest +``` + +### Verify the image is up + +You can query `/health` endpoint to verify that the coderabbit-agent service is up and running. + +```bash +curl 127.0.0.1:8080/health +``` + +## Host the image + +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: + +```bash +docker run --env-file .env --publish 127.0.0.1:8080:8080 us-docker.pkg.dev/coderabbitprod/self-hosted/coderabbit-agent:latest +``` From dd5438c47f0cf1b8b41daa27010b6811557d6ee2 Mon Sep 17 00:00:00 2001 From: alexcoderabbitai Date: Fri, 13 Dec 2024 10:03:54 -0500 Subject: [PATCH 2/8] Update docs/self-hosted/bitbucket.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- docs/self-hosted/bitbucket.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/self-hosted/bitbucket.md b/docs/self-hosted/bitbucket.md index ee57ea07..f1f575e2 100644 --- a/docs/self-hosted/bitbucket.md +++ b/docs/self-hosted/bitbucket.md @@ -83,7 +83,7 @@ LINEAR_PAT=[] :::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. +Values marked with [] are optional and can be omitted if the feature is not needed. - You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. ::: From 78d723a08b20b9176343674d85eb060cbc2bff04 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:04:22 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=8E=A8=20pnpm=20run=20lint:fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [dependabot skip] --- docs/self-hosted/bitbucket.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/self-hosted/bitbucket.md b/docs/self-hosted/bitbucket.md index f1f575e2..e187e11d 100644 --- a/docs/self-hosted/bitbucket.md +++ b/docs/self-hosted/bitbucket.md @@ -83,7 +83,7 @@ LINEAR_PAT=[] :::note - If you are using Azure OpenAI, verify that the model deployment names are in the .env file. -Values marked with [] are optional and can be omitted if the feature is not needed. + Values marked with [] are optional and can be omitted if the feature is not needed. - You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. ::: From f076207e62e9cc8e4583575dc78defe21e203ca1 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Dec 2024 10:05:12 -0500 Subject: [PATCH 4/8] fix bitbucket name --- docs/self-hosted/bitbucket.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/self-hosted/bitbucket.md b/docs/self-hosted/bitbucket.md index e187e11d..c33b4442 100644 --- a/docs/self-hosted/bitbucket.md +++ b/docs/self-hosted/bitbucket.md @@ -1,7 +1,7 @@ --- -title: Use Self-Hosted CodeRabbit With Bitbucket Server -sidebar_label: Bitbucket Server -description: Instructions to self-host CodeRabbit and integrate it with Bitbucket Server. +title: Use Self-Hosted CodeRabbit With Bitbucket Datacenter +sidebar_label: Bitbucket Datacenter +description: Instructions to self-host CodeRabbit and integrate it with Bitbucket Datacenter. sidebar_position: 4 --- From 6e672ade342412ef74cb47a5a72a46dccc91db43 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:05:45 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=8E=A8=20pnpm=20run=20lint:fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [dependabot skip] --- docs/self-hosted/bitbucket.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/self-hosted/bitbucket.md b/docs/self-hosted/bitbucket.md index c33b4442..12575148 100644 --- a/docs/self-hosted/bitbucket.md +++ b/docs/self-hosted/bitbucket.md @@ -1,6 +1,6 @@ --- title: Use Self-Hosted CodeRabbit With Bitbucket Datacenter -sidebar_label: Bitbucket Datacenter +sidebar_label: Bitbucket Datacenter description: Instructions to self-host CodeRabbit and integrate it with Bitbucket Datacenter. sidebar_position: 4 --- From bb78a2bd4a44133a1d1c3d5b7e5e703643dba08a Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Dec 2024 10:12:28 -0500 Subject: [PATCH 6/8] add to platform list --- docs/platforms/platforms.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/platforms.md b/docs/platforms/platforms.md index ef7a8792..12547cf3 100644 --- a/docs/platforms/platforms.md +++ b/docs/platforms/platforms.md @@ -30,9 +30,9 @@ CodeRabbit supports various Git platforms to provide code review for your reposi ## Bitbucket -| Host | Support | -| --------------------- | ----------- | -| Cloud | Coming soon | -| Bitbucket Data Center | [Supported] | +| Host | Support | +| --------------------- | ------------------------------------------ | +| Bitbucket Datacenter | [Supported](../self-hosted/bitbucket.md) | +| Bitbucket Cloud | Coming soon | [login]: https://app.coderabbit.ai/login From bdd03119666511c83e67632747acce481306dbce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:13:01 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=8E=A8=20pnpm=20run=20lint:fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [dependabot skip] --- docs/platforms/platforms.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/platforms.md b/docs/platforms/platforms.md index 12547cf3..8c7c8a1e 100644 --- a/docs/platforms/platforms.md +++ b/docs/platforms/platforms.md @@ -30,9 +30,9 @@ CodeRabbit supports various Git platforms to provide code review for your reposi ## Bitbucket -| Host | Support | -| --------------------- | ------------------------------------------ | -| Bitbucket Datacenter | [Supported](../self-hosted/bitbucket.md) | -| Bitbucket Cloud | Coming soon | +| Host | Support | +| -------------------- | ---------------------------------------- | +| Bitbucket Datacenter | [Supported](../self-hosted/bitbucket.md) | +| Bitbucket Cloud | Coming soon | [login]: https://app.coderabbit.ai/login From a26a25113a26b99a6d4e140923953951af04d211 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Dec 2024 10:24:04 -0500 Subject: [PATCH 8/8] fixing platforms page --- docs/platforms/platforms.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/platforms/platforms.md b/docs/platforms/platforms.md index 8c7c8a1e..ab0cc068 100644 --- a/docs/platforms/platforms.md +++ b/docs/platforms/platforms.md @@ -11,22 +11,24 @@ CodeRabbit supports various Git platforms to provide code review for your reposi | Host | Support | | ------------------------ | ---------------------------------------- | -| GitHub.com | [Supported][login] | +| GitHub.com | [Supported](jiasu.xzqcsaa.nyc.mn.md) | | GitHub Enterprise Server | [Supported](github-enterprise-server.md) | +| GitHub Self Hosted | [Supported](../self-hosted/github.md) | ## GitLab -| Host | Support | -| ------------------- | ---------------------------------- | -| GitLab.com | [Supported](gitlab-com.md) | -| GitLab Self Managed | [Supported](self-hosted-gitlab.md) | +| Host | Support | +| ------------------- | ------------------------------------- | +| GitLab.com | [Supported](gitlab-com.md) | +| GitLab Self Managed | [Supported](self-hosted-gitlab.md) | +| GitLab Self Hosted | [Supported](../self-hosted/gitlab.md) | ## Azure DevOps -| Host | Support | -| ------------------- | ---------------------------- | -| Azure DevOps | [Supported](azure-devops.md) | -| Azure DevOps Server | [Supported] | +| Host | Support | +| ------------------- | ------------------------------------------- | +| Azure DevOps | [Supported](azure-devops.md) | +| Azure DevOps Server | [Supported](../self-hosted/azure-devops.md) | ## Bitbucket