CircleCI CLI について
CircleCI CLI は設定ファイルの検証、パイプラインジョブのローカル実行、orb の管理ができます。開発者はコミット前に設定とジョブをテストでき、フィードバックループが高速化されます。
主な機能
- 01CircleCI 設定ファイルの構文と構造を検証する
- 02パイプラインジョブをローカルで実行してテストする
- 03CircleCI orb を検索・管理する
活用シーン
- 01開発中に CI/CD 設定を素早く反復し、フィードバックを得る
- 02リモートリポジトリにプッシュする前に設定変更をテストする
インストール
OS またはパッケージマネージャーを選び、コマンドをターミナルで実行します。
インストール後にcircleci --versionを実行して確認します。
コマンド例
よく使うコマンドを使う順に並べています。
詳細
circleci-cli
CircleCI のコマンドラインアプリケーションです。
circleci は CircleCI 公式のコマンドラインツールです。CI の実行、ジョブ、設定、その他の CircleCI の機能を、作業中のターミナルで利用できる、エージェントに適した CLI です。
CLI は circleci.com および CircleCI サーバーのユーザーに対応しており、macOS、Windows、Linux で利用できます。
インストール
以下のパッケージマネージャーのいずれかを使用して CLI をインストールします。
Homebrew
brew install circleci
WinGet
winget install --id CircleCI.CLI
Snap
sudo snap install circleci
sudo snap connect circleci:password-manager-service
Debian
Debian パッケージは、以下を含むさまざまなオペレーティングシステム向けに packages.circleci.com でホストされています。
パッケージをインストールするには、次のコマンドでリポジトリをすばやく自動設定できます。
curl -1sLf 'https://packages.circleci.com/public/setup.deb.sh' | sudo -E bash
または、パッケージをインストールする前に、手動で設定することもできます。
apt-get install -y debian-keyring # debian only
apt-get install -y debian-archive-keyring # debian only
apt-get install -y apt-transport-https
# For Debian Stretch, Ubuntu 16.04 and later
keyring_location=/usr/share/keyrings/circleci-deps-public-archive-keyring.gpg
# For Debian Jessie, Ubuntu 15.10 and earlier
keyring_location=/etc/apt/trusted.gpg.d/circleci-deps-public.gpg
curl -1sLf 'https://packages.circleci.com/public/gpg.B3F71F41836351D6.key' | gpg --dearmor >> ${keyring_location}
curl -1sLf 'https://packages.circleci.com/public/config.deb.txt?distro=ubuntu&codename=xenial&component=main' > /etc/apt/sources.list.d/circleci-deps-public.list
sudo chmod 644 ${keyring_location}
sudo chmod 644 /etc/apt/sources.list.d/circleci-deps-public.list
apt-get update
注:上記の ubuntu、xenial、main は、実際のオペレーティングシステム(ディストリビューションおよびディストリビューションのリリース/バージョン)とコンポーネント(このリポジトリに記載されているもの)に置き換えてください。
続いて、インストールします。
sudo apt install circleci
RedHat
RPM パッケージは、以下を含むさまざまなオペレーティングシステム向けに packages.circleci.com でホストされています。
ほとんどの RPM ベースのディストリビューション(RHEL、CentOS、Fedora、SUSE)では、次のコマンドでリポジトリをすばやく自動設定できます。
curl -1sLf 'https://packages.circleci.com/public/setup.rpm.sh' | sudo -E bash
または、Yum を手動で設定します(RHEL、CentOS、Amazon Linux)。
yum install yum-utils pygpgme
rpm --import 'https://packages.circleci.com/public/gpg.B3F71F41836351D6.key'
curl -1sLf 'https://packages.circleci.com/public/config.rpm.txt?distro=el&codename=7' > /tmp/circleci-deps-public.repo
yum-config-manager --add-repo '/tmp/circleci-deps-public.repo'
yum -q makecache -y --disablerepo='*' --enablerepo='circleci-deps-public'
注:el と 7 は実際のディストリビューション/バージョンに置き換え、複数のリポジトリを有効にする場合はワイルドカードを使用してください。
または、DNF を手動で設定します(Fedora)。
dnf install yum-utils pygpgme
rpm --import 'https://packages.circleci.com/public/gpg.B3F71F41836351D6.key'
curl -1sLf 'https://packages.circleci.com/public/config.rpm.txt?distro=fedora&codename=29&dnf_version=5' > /tmp/circleci-deps-public.repo
dnf config-manager addrepo --from-repofile='/tmp/circleci-deps-public.repo'
dnf -q makecache -y --disablerepo='*' --enablerepo='circleci-deps-public' --enablerepo='circleci-deps-public-source'
注:fedora と 29 は実際のディストリビューション/バージョンに置き換えてください。
続いて、インストールします。
dnf install circleci
または:
yum install circleci
セットアップ
ログイン
次のコマンドを実行して、CircleCI CLI にログインします。
circleci auth login
Model Context Protocol(MCP)
CLI は MCP プロトコルに対応しています。有効にするには、次を実行します。
Claude:
circleci mcp claude enable # Enable in Claude desktop
claude mcp add-from-claude-desktop -s user # Add with current user scope
Cursor:
circleci mcp cursor enable
VS Code:
circleci mcp vscode enable
開発
ローカル
このリポジトリでは Task を使用しています。MacOS では次のコマンドでインストールできます。
$ brew install go-task/tap/go-task
Taskfile.yml で参照されているその他のツールの大半は、go.mod の tool セクションで管理されています。
task -l を実行すると、利用可能なタスクの一覧を確認できます。または、Taskfile.yml スクリプトを参照してください。
# Run all static checks
task check
# Auto-fix static checks
task fix
# Run all the tests
task test
# Run the quick tests
task test -- -short ./...
# Run the quick tests for one package
task test -- -short ./internal/...
# Format all the code
task fmt
# Apply license headers
task license
# Tidy go.mod
task mod-tidy