> ## 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 a BlueKing Pipeline

> Use the prebuilt PawSQL connector to review SQL and enforce a quality gate in a BlueKing pipeline.

The PawSQL BlueKing pipeline connector adds an SQL review stage to a BlueKing pipeline. The stage collects the changed SQL, submits it to PawSQL, and enforces the quality gate as a pipeline decision.

## Goal

Use the prebuilt PawSQL connector to review SQL and enforce a quality gate in a BlueKing pipeline.

## Before you begin

* Confirm that PawSQL supports the BlueKing version and pipeline engine in use.
* Prepare the PawSQL project, workspace, and review policy.
* Issue a least-privilege identity for the connector.
* Identify the SQL locations, database type, and pipeline stage where review runs.
* Ensure the pipeline agent can reach the PawSQL endpoint.

## Configuration

<Steps>
  <Step title="Install or add the connector">Add the PawSQL pipeline connector to the BlueKing pipeline as a stage or plugin step.</Step>
  <Step title="Configure the connector">Provide the PawSQL endpoint, identity, project, workspace, policy, and report settings.</Step>
  <Step title="Set the SQL scope">Point to the SQL directories and file patterns changed in the build.</Step>
  <Step title="Define the gate">Choose the failure criteria, thresholds, and behavior on service error or timeout.</Step>
  <Step title="Configure feedback">Publish the summary, finding counts, and report link to the pipeline result.</Step>
  <Step title="Run acceptance tests">Exercise pass, block, no-SQL, parse-error, and service-failure cases.</Step>
</Steps>

## Gate behavior

The connector reads the review result and maps the decision to the pipeline. See [SQL Quality Gates and Feedback](/en/user-guide/cicd/pipeline-gate) for the recommended decision table and status mapping.

## Acceptance criteria

* The pipeline references the current build revision.
* The correct workspace and policy are applied.
* Only SQL within the declared scope is collected.
* A blocking finding fails the stage with an explanatory message.
* A system failure follows the configured failure policy and leaves an audit record.
* The report link is accessible to authorized pipeline viewers.

## Verification

Confirm the pipeline references the current revision and that a blocking finding fails the stage with an explanatory message.

<Note>
  For pipelines other than BlueKing that are not covered by a prebuilt connector, evaluate the [OpenAPI pipeline pattern](/en/user-guide/cicd/openapi-pipeline).
</Note>
