GitLab
Dropstone を GitLab の issue とマージリクエストで使用します。
Dropstone は GitLab CI/CD パイプラインまたは GitLab Duo を通じて GitLab ワークフローと統合されます。
どちらの場合でも、Dropstone は GitLab ランナー上で実行されます。
GitLab CI
Dropstone は通常の GitLab パイプラインで動作します。CI コンポーネントとしてパイプラインに組み込むことができます。
ここでは、Dropstone 用のコミュニティ作成 CI/CD コンポーネント nagyv/gitlab-dropstone を使用しています。
機能
- ジョブごとにカスタム設定を使用:
./config/#custom-directoryなどのカスタム設定ディレクトリで Dropstone を設定し、Dropstone の呼び出しごとに機能を有効または無効にします。 - 最小限のセットアップ: CI コンポーネントがバックグラウンドで Dropstone をセットアップするため、Dropstone 設定と初期プロンプトを作成するだけです。
- 柔軟性: CI コンポーネントは動作をカスタマイズするための複数の入力をサポートしています。
セットアップ
-
Dropstone 認証 JSON を Settings > CI/CD > Variables の下のファイルタイプ CI 環境変数として保存します。「Masked and hidden」としてマークしてください。
-
.gitlab-ci.ymlファイルに以下を追加します。include: - component: $CI_SERVER_FQDN/nagyv/gitlab-dropstone/dropstone@2 inputs: config_dir: ${CI_PROJECT_DIR}/dropstone-config auth_json: $DROPSTONE_AUTH_JSON # Dropstone 認証 JSON の変数名 command: optional-custom-command message: "Your prompt here"
このコンポーネントの詳細な入力とユースケースについては、ドキュメントを確認してください。
GitLab Duo
Dropstone は GitLab ワークフローと統合されます。
コメントで @dropstone に言及すると、Dropstone は GitLab CI パイプライン内でタスクを実行します。
機能
- Issue のトリアージ: Dropstone に issue を調査して説明するよう依頼します。
- 修正と実装: Dropstone に issue を修正または機能を実装するよう依頼します。 新しいブランチを作成し、変更内容を含むマージリクエストを作成します。
- セキュア: Dropstone は GitLab ランナー上で実行されます。
セットアップ
Dropstone は GitLab CI/CD パイプラインで実行されます。セットアップに必要なものは以下の通りです。
ヒント:
最新の手順については、GitLab ドキュメントを確認してください。
- GitLab 環境を設定します
- CI/CD をセットアップします
- Dropstone API キーを取得します (クイックスタートを参照)
- サービスアカウントを作成します
- CI/CD 変数を設定します
- フロー設定ファイルを作成します。例:
image: node:22-slim
commands:
- echo "Installing Dropstone"
- curl -fsSL https://dropstone.io/install | bash
- echo "Installing glab"
- export GITLAB_TOKEN=$GITLAB_TOKEN_DROPSTONE
- apt-get update --quiet && apt-get install --yes curl wget gpg git && rm --recursive --force /var/lib/apt/lists/*
- curl --silent --show-error --location "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash
- apt-get install --yes glab
- echo "Configuring glab"
- echo $GITLAB_HOST
- echo "Creating Dropstone auth configuration"
- mkdir --parents ~/.local/share/dropstone
- |
cat > ~/.local/share/dropstone/auth.json << EOF
{
"dropstone": {
"type": "api",
"key": "$DROPSTONE_API_KEY"
}
}
EOF
- echo "Configuring git"
- git config --global user.email "dropstone@gitlab.com"
- git config --global user.name "Dropstone"
- echo "Testing glab"
- glab issue list
- echo "Running Dropstone"
- |
dropstone run "
You are an AI assistant helping with GitLab operations.
Context: $AI_FLOW_CONTEXT
Task: $AI_FLOW_INPUT
Event: $AI_FLOW_EVENT
Please execute the requested task using the available GitLab tools.
Be thorough in your analysis and provide clear explanations.
Use the glab CLI to access data from GitLab. The glab CLI is already authenticated.
If you are asked to summarize an MR or issue, or provide more information,
post back a note to the MR/Issue so the user can see it.
"
- git checkout --branch $CI_WORKLOAD_REF origin/$CI_WORKLOAD_REF
- echo "Checking for git changes and pushing if any exist"
- |
if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
echo "Git changes detected, adding and pushing..."
git add .
if git diff --cached --quiet; then
echo "No staged changes to commit"
else
echo "Committing changes to branch: $CI_WORKLOAD_REF"
git commit --message "Dropstone changes"
echo "Pushing changes up to $CI_WORKLOAD_REF"
git push "https://gitlab-ci-token:$GITLAB_TOKEN@$GITLAB_HOST/$CI_PROJECT_PATH.git" $CI_WORKLOAD_REF
echo "Changes successfully pushed"
fi
else
echo "No git changes detected, skipping push"
fi
variables:
- DROPSTONE_API_KEY
- GITLAB_TOKEN_DROPSTONE
- GITLAB_HOST
詳細な手順については、GitLab Duo Agent Platform ドキュメントを参照してください。
例
GitLab で Dropstone を使用する方法の例を以下に示します。
ヒント:
@dropstone 以外のトリガーフレーズを設定できます。
-
Issue を説明する
GitLab issue にこのコメントを追加します。
@dropstone explain this issueDropstone は issue を読み、明確な説明で返信します。
-
Issue を修正する
GitLab issue で以下のように言います。
@dropstone fix thisDropstone は新しいブランチを作成し、変更を実装し、変更内容を含むマージリクエストを開きます。
-
マージリクエストをレビューする
GitLab マージリクエストに以下のコメントを残します。
@dropstone review this merge requestDropstone はマージリクエストをレビューし、フィードバックを提供します。