feat(integrations): add GitLab as alternative SCM provider#1092
Open
suda wants to merge 1 commit intomongrel-intelligence:devfrom
Open
feat(integrations): add GitLab as alternative SCM provider#1092suda wants to merge 1 commit intomongrel-intelligence:devfrom
suda wants to merge 1 commit intomongrel-intelligence:devfrom
Conversation
Add GitLab as a second SCM integration alongside GitHub, following the existing IntegrationModule/SCMIntegration architecture. This enables CASCADE to process GitLab merge request webhooks and run agents against GitLab repositories. Key additions: - Core GitLab module (client via @gitbeaker/rest, dual-persona model, SCMIntegration implementation) - Router layer (webhook route, signature verification, adapter, queue types) - 9 trigger handlers (MR opened, pipeline success/failure, approval, reviewer added, comment mention, merged, conflict detected, ready to merge) - 11 GitLab gadgets for agent MR operations - SCM-provider-aware context pipeline, CLI commands, tool manifests, and agent system prompts - Frontend SCM tab with GitHub/GitLab provider selector - CLI webhook commands with --gitlab-only support - GitLab webhook CRUD via API - Worker entry GitLab job dispatch with CASCADE_SCM_PROVIDER env var - PR/MR URL extraction supports both /pull/NNN and /merge_requests/NNN - Post-execution work-item linking works for GitLab MRs - Database migration for gitlab SCM provider CHECK constraint - glab CLI installed in worker Docker image - 100 unit tests across 7 test files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
@zbigniewsobiecki thank you for open sourcing this tool! It's exactly what I was looking for. Given that we use mostly Gitlab, together with Claude we added support for it across the repo. All agents are working/being triggered correctly:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds GitLab as a second SCM integration alongside GitHub, following the existing
IntegrationModule/SCMIntegrationarchitecture. Projects can now be configured to use GitLab as their SCM provider, with full webhook processing, trigger dispatch, agent execution, and dashboard management.Core module (
src/gitlab/):@gitbeaker/restwithAsyncLocalStorage-scoped credentialsGitLabSCMIntegrationimplementing theSCMIntegrationinterfaceRouter & webhook layer:
/gitlab/webhookroute withX-Gitlab-Tokensignature verificationGitLabRouterAdapterimplementingRouterPlatformAdapterGitLabJobqueue type, worker dispatch,CASCADE_SCM_PROVIDERenv var injection9 trigger handlers (
src/triggers/gitlab/):merge_requestis null (branch push pipelines)11 GitLab gadgets (
src/gadgets/gitlab/):SCM-provider-aware agent runtime:
fetchPRContextStep,fetchPRConversationStep) uses GitLab API for GitLab projectsCASCADE_SCM_PROVIDER=gitlabglabCLI likeghcascade-tools scmCLI commands dispatch to GitLab gadgets at runtime--owner/--repoparams hidden from agent tool guidance (no more complex sed)extractPRUrl/extractPRNumbersupport both/pull/NNNand/merge_requests/NNNCredential resolution fix:
getIntegrationCredentialnow looks up the project's configured provider before resolving env var keys (previously always returned GitHub keys when both providers were registered)Frontend & CLI:
gitlabCreateWebhook,gitlabDeleteWebhook)--gitlab-onlysupportInfrastructure:
0049_add_gitlab_scm_provider.sql— adds'gitlab'to the CHECK constraintglabCLI v1.52.0 installed in worker Docker imageproviders: [github, gitlab]Test Plan
npm test) — 7109 passing, 100 new GitLab testsnpm run lint)npm run typecheck)cascade-tools scmcommands work in GitLab worker contextNew test files (100 tests):
tests/unit/gitlab/personas.test.ts(16 tests)tests/unit/triggers/gitlab/types.test.ts(19 tests)tests/unit/triggers/gitlab/pipeline-success.test.ts(12 tests)tests/unit/triggers/gitlab/pipeline-failure.test.ts(13 tests)tests/unit/triggers/gitlab/mr-opened.test.ts(11 tests)tests/unit/triggers/gitlab/mr-reviewer-added.test.ts(12 tests)tests/unit/router/adapters/gitlab.test.ts(17 tests)Known Issues
The
npm auditCI step fails with 6 moderate-severity vulnerabilities. These are pre-existing — they exist ondevas well and are not introduced by this PR:@anthropic-ai/sdk0.79.0-0.80.0 (memory tool path validation) — fix requires breaking@anthropic-ai/claude-agent-sdkdowngradeesbuild≤0.24.2 (dev server request bypass) — fix requires breakingdrizzle-kitdowngradeThe
hono,@hono/node-server, andaxiosvulnerabilities were fixed bynpm audit fixin this PR.Checklist