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

# Aikido CLI: リリースゲートの GitLab パイプライン設定

### 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 Pipeline ジョブを作成する

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

> ローカルスキャナーがデフォルトブランチでのみトリガーされるようにしてください。以下の例では、それは '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 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/pr-torirsunogtingu/cli-for-pr-and-release-gating/gitlab-pipeline-setup-for-aikido-cli-release-gating.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.
