-
Notifications
You must be signed in to change notification settings - Fork 169
feat(ee): GitLab permission syncing #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
WalkthroughThis PR extends permission syncing to support GitLab alongside GitHub. It adds GitLab client factory functions, integrates GitLab API calls into repo and user permission syncers with per-job logging, adds a GitLab base URL environment variable, updates OAuth scope handling for GitLab SSO to conditionally include read_api, and refactors job scheduling from transactional to non-transactional creation. Changes
Sequence Diagram(s)sequenceDiagram
participant Job
participant Syncer
participant GitLabAPI
participant DB
participant Logger
rect rgba(100, 150, 200, 0.2)
Note over Syncer: GitLab Permission Sync Flow
Job->>Syncer: runJob(repoId, userId)
Syncer->>Logger: createJobLogger(jobId)
Syncer->>GitLabAPI: createGitLabFromOAuthToken(token)
GitLabAPI-->>Syncer: Gitlab client
Syncer->>GitLabAPI: getProjectMembers(projectId)
GitLabAPI-->>Syncer: members array
Syncer->>DB: mapMembersToUserIds()
DB-->>Syncer: userId[]
Syncer-->>Job: return mapped IDs
end
rect rgba(150, 200, 100, 0.2)
Note over Syncer: GitHub Permission Sync Flow (existing)
Job->>Syncer: runJob(repoId, userId)
Syncer->>GitLabAPI: Fetch via GitHub API
GitLabAPI-->>Syncer: collaborators
Syncer-->>Job: return mapped IDs
end
rect rgba(200, 100, 100, 0.2)
Note over Syncer: Job Scheduling (changed)
Job->>DB: createJob() [non-transactional]
DB-->>Job: jobRecord
Job->>Syncer: enqueueJob(jobRecord)
Syncer-->>Job: success
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/backend/src/constants.ts(1 hunks)packages/backend/src/ee/repoPermissionSyncer.ts(6 hunks)packages/backend/src/ee/userPermissionSyncer.ts(6 hunks)packages/backend/src/env.ts(1 hunks)packages/backend/src/gitlab.ts(3 hunks)packages/backend/src/repoCompileUtils.ts(0 hunks)packages/web/src/ee/features/sso/sso.ts(1 hunks)
💤 Files with no reviewable changes (1)
- packages/backend/src/repoCompileUtils.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*
📄 CodeRabbit inference engine (.cursor/rules/style.mdc)
Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.
Files:
packages/backend/src/env.tspackages/backend/src/ee/repoPermissionSyncer.tspackages/web/src/ee/features/sso/sso.tspackages/backend/src/constants.tspackages/backend/src/ee/userPermissionSyncer.tspackages/backend/src/gitlab.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
This PR adds support for GitLab permission syncing.
Summary by CodeRabbit