Skip to content

Commit 61d74f3

Browse files
authored
Merge pull request #96 from DataRecce/feature/drc-3041-gitlab-service-account
docs: add GitLab service account guidance for bot identity
2 parents 8cdc311 + a29c021 commit 61d74f3

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

docs/setup-guides/connect-git.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,44 @@ Then select the repository containing your dbt project. This becomes your Cloud
5050

5151
## Connect GitLab
5252

53-
GitLab uses Personal Access Tokens (PAT) instead of OAuth.
53+
GitLab uses Personal Access Tokens (PAT) instead of OAuth. Unlike GitHub, where the Recce GitHub App posts comments as itself, GitLab API comments appear as the token owner. We recommend creating a dedicated service account so that PR comments appear as a bot rather than your personal account.
5454

55-
### 1. Create a Personal Access Token
55+
!!! tip "Use a shared team email"
56+
When creating the service account, use a shared team email (e.g., `data@yourcompany.com`) so it isn't tied to any individual.
5657

57-
In GitLab: User Settings → Access Tokens → Add new token.
58+
### 1. Create a Dedicated Service Account (Recommended)
5859

59-
**Required scopes:**
60+
If you use your personal token, your teammates see PR comments from *you* rather than from Recce Cloud. To avoid this, create a **GitLab service account** for Recce Cloud:
6061

61-
- `api` - Full access (required for PR comments)
62-
- `read_api` - Read-only alternative (limited functionality)
62+
1. In GitLab, navigate to your **group → Settings → Service Accounts**
63+
2. Click **Add service account**
64+
3. Set the name to **Recce Cloud** (username auto-generates)
65+
4. Click **Create service account**
66+
5. (Optional) Edit the account to customize the username and upload a Recce avatar
6367

64-
**Expected result:** Token string displayed (copy immediately).
68+
**Expected result:** Service account appears in the group's member list with a "service account" badge.
6569

66-
### 2. Add Token to Cloud
70+
Add the service account as a **Developer** member to the projects you want Recce Cloud to access.
6771

68-
Navigate to Settings → Git Provider. Select GitLab, paste token.
72+
!!! info "Availability"
73+
GitLab service accounts are available on GitLab.com Free (up to 100 per group), Premium, and Ultimate. For Self-Managed Free instances where service accounts are unavailable, create a dedicated GitLab user (e.g., `recce-cloud-bot`) instead.
74+
75+
If you don't have group admin access, you can skip this step and use a personal access token directly. Note that PR comments will appear as your user account.
76+
77+
### 2. Create a Personal Access Token
78+
79+
Generate a PAT for the service account (or your personal account if you skipped Step 1):
80+
81+
1. For a **service account**: navigate to your **group → Settings → Service Accounts**, select the account, and click **Create token**
82+
2. For a **personal token**: navigate to **User Settings → Access Tokens → Add new token**
83+
3. Set a descriptive name (e.g., "Recce Cloud integration")
84+
4. Select the **`api`** scope (required for posting PR comments). The `read_api` scope is not sufficient.
85+
5. Set an expiration date and click **Create**
86+
6. Copy the token immediately (it cannot be viewed again)
87+
88+
### 3. Add Token to Cloud
89+
90+
Navigate to **Settings → Git Provider** in Recce Cloud. Select GitLab and paste the token.
6991

7092
## Verify Success
7193

@@ -84,6 +106,7 @@ In Cloud, navigate to your repository. You should see:
84106
| Repository not found | Ensure proper permissions are granted (GitLab: token access, GitHub: app authorized) |
85107
| Invalid token (GitLab) | Generate new token with `api` scope |
86108
| Cannot post PR comments (GitLab) | Regenerate token with `api` scope instead of `read_api` |
109+
| PR comments show as personal user (GitLab) | Create a [service account](#1-create-a-dedicated-service-account-recommended) and use its token instead of your personal token |
87110

88111
## Next Steps
89112

0 commit comments

Comments
 (0)