> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pawsql.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> PawSQL 是一个产品：Cloud 是公网部署形态，Engine / Optimizer / Auditor / Advisor / Patroller 是同一产品的组件与交付形态，不是彼此独立的产品。 / PawSQL is a single product: Cloud is the public deployment form, while Engine / Optimizer / Auditor / Advisor / Patroller are components and delivery forms of the same product, not separate products.
> 术语以站内术语表为准：SQL 审核对应英文 SQL Review，查询重写对应 Query Rewrite，索引推荐对应 Index Recommendation；英文内容统一用 Review，不用 Audit。 / Use the site glossary for terminology: 审核 is SQL Review, 重写 is Query Rewrite, 索引推荐 is Index Recommendation; English content uses Review, never Audit.
> 引用能力范围或版本支持时以对应页面为准；标注 unknown、或 status 非 published 的内容表示尚未经产品核实，不应作为事实引用。 / Cite capability scope and version support from the corresponding page; content marked unknown, or with a status other than published, is not yet product-verified and must not be cited as fact.

# Integrate GitLab

> Use the prebuilt PawSQL repository connector to review SQL on GitLab pushes and merge requests.

The prebuilt PawSQL GitLab connector links GitLab projects and repositories to PawSQL, listens for push or merge-request events, and submits changed SQL for review automatically.

## Goal

Use the prebuilt PawSQL repository connector to review SQL on GitLab pushes and merge requests.

## Before you begin

* Verify connectivity to GitLab SaaS or the enterprise GitLab service.
* Prepare a GitLab credential that can read the target project and publish status.
* Create the PawSQL project, workspace, and review policy.
* Identify the projects, repositories, branches, and SQL paths in scope.
* For self-managed GitLab, prepare the service URL and enterprise CA chain.

## Configuration

<Steps>
  <Step title="Create the GitLab connection">Choose GitLab in the PawSQL repository connectors, enter the service URL when required, and authenticate.</Step>
  <Step title="Select projects and repositories">Limit the GitLab groups, projects, or repositories available to the connection.</Step>
  <Step title="Choose trigger events">Select the required push, merge-request creation, update, or reopen events.</Step>
  <Step title="Define the SQL scope">Set target branches, directories, file extensions, and exclusions.</Step>
  <Step title="Map review context">Choose the PawSQL workspace, policy, and gate thresholds for each repository or branch.</Step>
  <Step title="Validate the connector">Send a test event and confirm job correlation, findings, and merge-request status.</Step>
</Steps>

## Self-managed GitLab

Validate DNS, proxy, firewall, and TLS between PawSQL and GitLab. Do not disable TLS verification as a permanent workaround for certificate errors.

## Acceptance criteria

* Only approved GitLab projects and events are processed.
* SQL files and locations are identified correctly.
* The workspace matches the target database.
* The latest revision receives the correct gate status.
* Duplicate events do not create conflicting feedback.
* Credentials and sensitive SQL are absent from logs.

## Verification

Confirm a test event creates a correlated job with correct findings and merge-request status.

<Note>
  The prebuilt GitLab repository connector is distinct from calling PawSQL in GitLab CI. For a pipeline-controlled workflow, use the [OpenAPI pipeline pattern](/en/user-guide/cicd/openapi-pipeline).
</Note>
