GitLab Connection
The GitLab connection integrates your GitLab account with OpsTower, giving agents the ability to browse projects, read source files, search code, inspect commits and diffs, review merge requests, and monitor pipeline (CI/CD) status.
Prerequisites
Section titled “Prerequisites”You need a GitLab.com account. The connection uses OAuth 2.0 with PKCE, so you authorize OpsTower to access your projects directly from the UI. GitLab’s code search uses project-scoped blob search.
Setup in OpsTower
Section titled “Setup in OpsTower”- Go to Connections > Code > Add Connection.
- Select GitLab.
- Click Connect to GitLab.
- A popup opens to GitLab’s authorization page. Sign in and grant access.
- OpsTower automatically discovers your username and stores the connection.
- Optionally configure:
- Default Branch — the default branch for browsing and commits (default:
main) - Restrict to Project — limit agents to a single project (format:
namespace/projectorgroup/subgroup/project)
- Default Branch — the default branch for browsing and commits (default:
What Agents Can Do
Section titled “What Agents Can Do”Once connected, agents have access to eight tools:
- List Projects — discover all projects the connected user has access to, with visibility, default branch, and description
- Browse Repository — explore directory structure at any path and branch
- Read File — read file contents with line numbers, line range filtering, and binary detection (100KB limit)
- Search Code — search for code patterns within a specific project (project-scoped blob search)
- List Commits — view recent commits with author, date, and message, filtered by branch or path
- Get Commit — inspect a specific commit’s details with changed files and diff stats
- List Merge Requests — browse MRs by state (opened, closed, merged, all) with author, reviewers, draft status, and comment counts
- List Pipelines — monitor CI/CD pipeline runs with status, branch, duration, source, and direct links
Use Cases
Section titled “Use Cases”- “Show me the most recent commits to the payments service”
- “Find all usages of the
processPaymentfunction in our API project” - “What merge requests are currently open and waiting for review?”
- “Read the
src/services/billing.tsfile in our backend project” - “What pipeline runs failed on the main branch today?”
- “What changed in commit abc1234?”
Troubleshooting
Section titled “Troubleshooting”- OAuth popup blocked — allow popups for the OpsTower domain and try again
- Code search returns no results — GitLab code search is project-scoped; make sure to specify the project path
- Pipelines not found (404) — pipelines are not enabled for the project, or the project was not found
- Token expired — click “Reconnect to GitLab” to refresh the OAuth tokens
- Subgroups — GitLab supports nested groups; use the full path like
group/subgroup/projectwhen restricting access