Skip to content

Commit 3fd1504

Browse files
authored
Merge pull request #1628 from thonic/main
docs: Update description of gitlab-webhook installation.
2 parents 4ab2396 + a75d430 commit 3fd1504

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

docs/docs/installation/gitlab.md

+24-13
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,47 @@ Note that if your base branches are not protected, don't set the variables as `p
4343

4444
## Run a GitLab webhook server
4545

46-
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.
46+
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.
4747

48-
2. Generate a random secret for your app, and save it for later. For example, you can use:
48+
2. For the user from step 1. generate a `personal_access_token` with `api` access.
49+
50+
3. Generate a random secret for your app, and save it for later (`shared_secret`). For example, you can use:
4951

5052
```
51-
WEBHOOK_SECRET=$(python -c "import secrets; print(secrets.token_hex(10))")
53+
SHARED_SECRET=$(python -c "import secrets; print(secrets.token_hex(10))")
5254
```
5355

54-
3. Clone this repository:
56+
4. Clone this repository:
5557

5658
```
57-
git clone https://github.com/Codium-ai/pr-agent.git
59+
git clone https://github.com/qodo-ai/pr-agent.git
5860
```
5961

60-
4. Prepare variables and secrets. Skip this step if you plan on settings these as environment variables when running the agent:
62+
5. Prepare variables and secrets. Skip this step if you plan on setting these as environment variables when running the agent:
6163
1. In the configuration file/variables:
62-
- Set `deployment_type` to "gitlab"
64+
- Set `config.git_provider` to "gitlab"
6365

6466
2. In the secrets file/variables:
6567
- Set your AI model key in the respective section
66-
- In the [gitlab] section, set `personal_access_token` (with token from step 1) and `shared_secret` (with secret from step 2)
67-
68+
- In the [gitlab] section, set `personal_access_token` (with token from step 2) and `shared_secret` (with secret from step 3)
6869

69-
5. Build a Docker image for the app and optionally push it to a Docker repository. We'll use Dockerhub as an example:
70+
6. Build a Docker image for the app and optionally push it to a Docker repository. We'll use Dockerhub as an example:
7071
```
7172
docker build . -t gitlab_pr_agent --target gitlab_webhook -f docker/Dockerfile
7273
docker push codiumai/pr-agent:gitlab_webhook # Push to your Docker repository
7374
```
7475

75-
6. Create a webhook in GitLab. Set the URL to ```http[s]://<PR_AGENT_HOSTNAME>/webhook```, the secret token to the generated secret from step 2, and enable the triggers `push`, `comments` and `merge request events`.
76+
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.
77+
78+
```
79+
"CONFIG.GIT_PROVIDER": "gitlab"
80+
"GITLAB.PERSONAL_ACCESS_TOKEN": "<personal_access_token>"
81+
"GITLAB.SHARED_SECRET": "<shared_secret>"
82+
"GITLAB.URL": "https://gitlab.com"
83+
"OPENAI.KEY": "<your_openai_api_key>"
84+
```
85+
86+
8. Create a webhook in your GitLab project. Set the URL to ```http[s]://<PR_AGENT_HOSTNAME>/webhook```, the secret token to the generated secret from step 3, and enable the triggers `push`, `comments` and `merge request events`.
87+
88+
9. Test your installation by opening a merge request or commenting on a merge request using one of PR Agent's commands.
7689
77-
7. Test your installation by opening a merge request or commenting on a merge request using one of CodiumAI's commands.
78-
boxes

0 commit comments

Comments
 (0)