> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/kdosukyan/local-code-scanning/release-gating-for-code-using-local-scanner.md).

# ローカルスキャナーを使ったコードのリリースゲーティング

Aikido Local Scanner は、プルリクエストやリリースを含む CI パイプラインのさまざまな段階でセキュリティゲートを適用できます。

{% hint style="info" %}
クラウド接続されたワークスペース（GitHub、BitBucket など）でも PR ゲーティングを使用できます。CI をご覧ください [統合セクション](https://help.aikido.dev/section/ci-integrations/sg3q6UrIf4qE).
{% endhint %}

リリースゲーティングでは、コードが公開またはデプロイされる前にスキャンします。とは異なり [PR ゲーティング](/docs/docs-ja/kontenaimjisukyan/local-image-scanning/pr-gating-for-container-images-using-local-image-scanner.md)、プルリクエストで導入された変更のみをスキャンするのに対し、リリースゲーティングではビルド全体を評価します。スキャンで設定した重大度のしきい値以上の問題が見つかると、CI パイプラインは失敗し、リリースはブロックされます。

これにより、最終的なコードが本番環境に到達する前に、セキュリティ基準を満たしていることが保証されます。

リリースゲーティングを有効にするには、 `--fail-on <severity>` オプションをスキャンコマンドに追加します。

`aikido-local-scanner scan ./ --apikey $AIKIDO_LOCAL_SCANNER_TOKEN --repositoryname $CI_PROJECT_NAME --branchname main --fail-on critical`

## 例 <a href="#examples" id="examples"></a>

### GitLab Self Managed <a href="#gitlab-self-managed" id="gitlab-self-managed"></a>

GitLab 環境で Local Scanner をセットアップする一般的な情報については、次を確認してください [この記事](/docs/docs-ja/kdosukyan/local-code-scanning/gitlab-self-managed-setup-for-local-code-scanning.md).

例 `.gitlab-ci.yml` リリースゲーティングについては:

```yaml
の既定値のままにします:
  image:
    name: aikidosecurity/local-scanner:latest
    entrypoint: [""]

run_aikido_selfscanner:
  script:
  - aikido-local-scanner scan ./ --apikey $AIKIDO_LOCAL_SCANNER_TOKEN --repositoryname $CI_PROJECT_NAME --branchname main --fail-on critical
  rules:
    - if: $CI_COMMIT_BRANCH == "main"
```

### GitHub <a href="#github" id="github"></a>

GitHub 環境で Local Scanner をセットアップする方法に関する一般情報については、こちらを参照してください [この記事](/docs/docs-ja/kdosukyan/local-code-scanning/github-action-setup-for-local-code-scanning.md).\
例 `.github/workflows/aikido-scan.yml` リリースゲーティングについては:

```yaml
on:
  push:
    branches:
      - main

name: Aikido スキャン
jobs:
  aikido-local-scan-repo:
    runs-on: ubuntu-latest
    container:
      image: aikidosecurity/local-scanner:latest
    steps: 
      - uses: actions/checkout@v4 
        with: 
          token: ${{ secrets.GITHUB_TOKEN }} 
          path: my-repo 
      - name: スキャンを実行
        run: aikido-local-scanner scan my-repo --apikey ${{ secrets.AIKIDO_API_KEY }} --repositoryname MyRepo --branchname main --fail-on critical
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/kdosukyan/local-code-scanning/release-gating-for-code-using-local-scanner.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
