From 9d3bd7289a7713841b518ce7e96d4551fb250d48 Mon Sep 17 00:00:00 2001 From: "Hussam.lawen" Date: Mon, 17 Mar 2025 14:24:38 +0200 Subject: [PATCH 1/5] docs: add Bitbucket organization-level configuration documentation --- .../docs/usage-guide/configuration_options.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/docs/usage-guide/configuration_options.md b/docs/docs/usage-guide/configuration_options.md index a65d34fb..d0c295d3 100644 --- a/docs/docs/usage-guide/configuration_options.md +++ b/docs/docs/usage-guide/configuration_options.md @@ -69,3 +69,27 @@ For example, in the GitHub organization `Codium-ai`: - The file [`https://github.com/Codium-ai/pr-agent-settings/.pr_agent.toml`](https://github.com/Codium-ai/pr-agent-settings/blob/main/.pr_agent.toml) serves as a global configuration file for all the repos in the GitHub organization `Codium-ai`. - The repo [`https://github.com/Codium-ai/pr-agent`](https://github.com/Codium-ai/pr-agent/blob/main/.pr_agent.toml) inherits the global configuration file from `pr-agent-settings`. + +### Bitbucket Organization level configuration file 💎 +`Relevant platforms: Bitbucket Cloud, Bitbucket Data Center` + +In Bitbucket, there are two levels where you can define a global configuration file: + +* Project-level global configuration: + +Create a repository named `pr-agent-settings` within a specific project. The configuration file in this repository will apply to all repositories under the same project. + +* Organization-level global configuration: + +Create a dedicated project to hold a global configuration file that affects all repositories across all projects in your organization. + +**Setting up organization-level global configuration:** + +1. Create a new project with both the name and key: PR_AGENT_SETTINGS. +2. Inside the PR_AGENT_SETTINGS project, create a repository named pr-agent-settings. +3. In this repository, add a .pr_agent.toml configuration file—structured similarly to the global configuration file described above. + +Repositories across your entire Bitbucket organization will inherit the configuration from this file. + +!!! note "Note" +If both organization-level and project-level global settings are defined, the project-level settings will take precedence over the organization-level configuration. Additionally, parameters from a repository’s local .pr_agent.toml file will always override both global settings. From ed9fcd02385d8949b9580005eb29989f8fe394f7 Mon Sep 17 00:00:00 2001 From: "Hussam.lawen" Date: Mon, 17 Mar 2025 14:26:05 +0200 Subject: [PATCH 2/5] docs: add Bitbucket organization-level configuration documentation --- docs/docs/usage-guide/configuration_options.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/usage-guide/configuration_options.md b/docs/docs/usage-guide/configuration_options.md index d0c295d3..bbe8afa6 100644 --- a/docs/docs/usage-guide/configuration_options.md +++ b/docs/docs/usage-guide/configuration_options.md @@ -93,3 +93,4 @@ Repositories across your entire Bitbucket organization will inherit the configur !!! note "Note" If both organization-level and project-level global settings are defined, the project-level settings will take precedence over the organization-level configuration. Additionally, parameters from a repository’s local .pr_agent.toml file will always override both global settings. + From 4ea46d5b25cc49c78670c9540a822714ec3fcea0 Mon Sep 17 00:00:00 2001 From: "Hussam.lawen" Date: Mon, 17 Mar 2025 14:42:57 +0200 Subject: [PATCH 3/5] docs: fix formatting of note in configuration options --- docs/docs/usage-guide/configuration_options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/usage-guide/configuration_options.md b/docs/docs/usage-guide/configuration_options.md index bbe8afa6..1d671a61 100644 --- a/docs/docs/usage-guide/configuration_options.md +++ b/docs/docs/usage-guide/configuration_options.md @@ -92,5 +92,5 @@ Create a dedicated project to hold a global configuration file that affects all Repositories across your entire Bitbucket organization will inherit the configuration from this file. !!! note "Note" -If both organization-level and project-level global settings are defined, the project-level settings will take precedence over the organization-level configuration. Additionally, parameters from a repository’s local .pr_agent.toml file will always override both global settings. + If both organization-level and project-level global settings are defined, the project-level settings will take precedence over the organization-level configuration. Additionally, parameters from a repository’s local .pr_agent.toml file will always override both global settings. From fa77828db296e290fed85dc9c1ed4dd4ede35a88 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Tue, 18 Mar 2025 03:52:36 +0900 Subject: [PATCH 4/5] chore: update pr_reviewer_prompts.toml minor fix --- pr_agent/settings/pr_reviewer_prompts.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/settings/pr_reviewer_prompts.toml b/pr_agent/settings/pr_reviewer_prompts.toml index 74403a82..1c357056 100644 --- a/pr_agent/settings/pr_reviewer_prompts.toml +++ b/pr_agent/settings/pr_reviewer_prompts.toml @@ -66,7 +66,7 @@ class SubPR(BaseModel): class KeyIssuesComponentLink(BaseModel): relevant_file: str = Field(description="The full file path of the relevant file") - issue_header: str = Field(description="One or two word title for the the issue. For example: 'Possible Bug', etc.") + issue_header: str = Field(description="One or two word title for the issue. For example: 'Possible Bug', etc.") issue_content: str = Field(description="A short and concise summary of what should be further inspected and validated during the PR review process for this issue. Do not reference line numbers in this field.") start_line: int = Field(description="The start line that corresponds to this issue in the relevant file") end_line: int = Field(description="The end line that corresponds to this issue in the relevant file") From a75d430751497e252ef992650eda180150c67be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Hoskovec?= Date: Tue, 18 Mar 2025 15:29:27 +0100 Subject: [PATCH 5/5] docs: Update description of gitlab-webhook installation. --- docs/docs/installation/gitlab.md | 37 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/docs/docs/installation/gitlab.md b/docs/docs/installation/gitlab.md index af5536f0..998d8583 100644 --- a/docs/docs/installation/gitlab.md +++ b/docs/docs/installation/gitlab.md @@ -43,36 +43,47 @@ Note that if your base branches are not protected, don't set the variables as `p ## Run a GitLab webhook server -1. From the GitLab workspace or group, create an access token with "Reporter" role ("Developer" if using Pro version of the agent) and "api" scope. +1. In GitLab create a new user and give it "Reporter" role ("Developer" if using Pro version of the agent) for the intended group or project. -2. Generate a random secret for your app, and save it for later. For example, you can use: +2. For the user from step 1. generate a `personal_access_token` with `api` access. + +3. Generate a random secret for your app, and save it for later (`shared_secret`). For example, you can use: ``` -WEBHOOK_SECRET=$(python -c "import secrets; print(secrets.token_hex(10))") +SHARED_SECRET=$(python -c "import secrets; print(secrets.token_hex(10))") ``` -3. Clone this repository: +4. Clone this repository: ``` -git clone https://github.com/Codium-ai/pr-agent.git +git clone https://github.com/qodo-ai/pr-agent.git ``` -4. Prepare variables and secrets. Skip this step if you plan on settings these as environment variables when running the agent: +5. Prepare variables and secrets. Skip this step if you plan on setting these as environment variables when running the agent: 1. In the configuration file/variables: - - Set `deployment_type` to "gitlab" + - Set `config.git_provider` to "gitlab" 2. In the secrets file/variables: - Set your AI model key in the respective section - - In the [gitlab] section, set `personal_access_token` (with token from step 1) and `shared_secret` (with secret from step 2) + - In the [gitlab] section, set `personal_access_token` (with token from step 2) and `shared_secret` (with secret from step 3) - -5. Build a Docker image for the app and optionally push it to a Docker repository. We'll use Dockerhub as an example: +6. Build a Docker image for the app and optionally push it to a Docker repository. We'll use Dockerhub as an example: ``` docker build . -t gitlab_pr_agent --target gitlab_webhook -f docker/Dockerfile docker push codiumai/pr-agent:gitlab_webhook # Push to your Docker repository ``` -6. Create a webhook in GitLab. Set the URL to ```http[s]:///webhook```, the secret token to the generated secret from step 2, and enable the triggers `push`, `comments` and `merge request events`. +7. Set the environmental variables, the method depends on your docker runtime. Skip this step if you included your secrets/configuration directly in the Docker image. + +``` +"CONFIG.GIT_PROVIDER": "gitlab" +"GITLAB.PERSONAL_ACCESS_TOKEN": "" +"GITLAB.SHARED_SECRET": "" +"GITLAB.URL": "https://gitlab.com" +"OPENAI.KEY": "" +``` + +8. Create a webhook in your GitLab project. Set the URL to ```http[s]:///webhook```, the secret token to the generated secret from step 3, and enable the triggers `push`, `comments` and `merge request events`. + +9. Test your installation by opening a merge request or commenting on a merge request using one of PR Agent's commands. -7. Test your installation by opening a merge request or commenting on a merge request using one of CodiumAI's commands. -boxes