> 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/pr-torirsugtingu/cli-for-pr-and-release-gating/gitlab-pipeline-setup-for-aikido-cli-release-gating.md).

# Aikido CLI: リリースゲーティングのGitLab Pipeline設定

Aikido Security CIクライアントを使用すると、Aikido SecurityのスキャンをCIパイプラインに統合できます。セキュリティスキャンをビルドプロセスの一部にできます。

### 1. APIキーを取得する <a href="#id-1-get-api-token" id="id-1-get-api-token"></a>

1. へ移動 [継続的インテグレーション設定ページ](https://app.aikido.dev/settings/integrations/continuous-integration).
2. トークンを生成してコピーします。このトークンは一度しか表示できないことに注意してください。
3. このトークンを次の名前で保存します *AIKIDO\_CLIENT\_API\_KEY* GitLabのCI/CD変数にシークレットとして保存します。Settings > CI/CD and Variables > Actions に移動してください。これはGitLabのグループレベルまたはプロジェクトレベルのどちらでも行えます

> APIキーを追加する際は、変数がすべてのブランチで利用可能であること（protect variable のチェックを外す）と、いかなるログでもマスクされること（"Mask variable" にチェックを入れる）を確認してください。"Expand variable reference" はチェックしたままで構いません。

### 2. 新しいGitLabパイプラインジョブを作成する

この例を使ってパイプラインジョブを作成します:

> ローカルスキャナーがデフォルトブランチでのみ起動されるようにしてください。以下の例では、それは 'main' ブランチです。必要に応じて調整してください。

{% tabs %}
{% tab title="YAML" %}

```yaml
stages:
  - security_check

aikido_release_gate:
  stage: security_check
  image: node:22
  script:
    - npm install --global @aikidosec/ci-api-client
    - |
      aikido-api-client scan-release \
        "$CI_PROJECT_ID" \
        "$CI_COMMIT_SHA" \
        --apikey "$AIKIDO_CLIENT_API_KEY" \
        --fail-on-sast-scan \
        --fail-on-iac-scan \
        --fail-on-secrets-scan
  only:
    - main
```

{% endtab %}

{% tab title="" %}

{% endtab %}
{% endtabs %}

必要に応じてコマンドを調整してください。すべてのオプションは [こちら](https://www.npmjs.com/package/@aikidosec/ci-api-client).

### 3. 最初のスキャンを実行する <a href="#id-3-run-your-first-scan" id="id-3-run-your-first-scan"></a>

新しい変更がデフォルトブランチにプッシュされると、ワークフローがトリガーされます。スキャンが実行され、新しい問題が検出された場合は失敗します。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/docs/docs-ja/pr-torirsugtingu/cli-for-pr-and-release-gating/gitlab-pipeline-setup-for-aikido-cli-release-gating.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
