CircleCI の設定をしているときに config の validation check をローカルでやりたくなった
調べたところ Using the CircleCI Local CLI - CircleCI というものがあったで導入する
インストール
とりあえず、記事に書いてある通りインストール(Mac を使ってます)
$ curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci
ヘルプコマンドを叩いてインストールされたかを確認する
$ circleci -h Receiving latest version of circleci... INFO: We've built a brand new CLI for CircleCI! Please run 'circleci switch' to upgrade. The CLI tool to be used in CircleCI. Usage: circleci [command] Available Commands: build Run a full build locally config Validate and update the circleCI configuration file help Help about any command step Execute steps tests Collect and split files with tests version Output version info Flags: -h, --help help for circleci --verbose enable verbose logging output Use "circleci [command] --help" for more information about a command.
簡単にインストールできた!
validation check
さっそく validation check をすべくコマンドを叩く
$ circleci config validate -c .circleci/config.yml INFO: We've built a brand new CLI for CircleCI! Please run 'circleci switch' to upgrade. Error: Error parsing config file: yaml: line 51: mapping values are not allowed in this context
ちゃんとエラーが検出されたのでチェックできていることがわかる
ついでになんかアップグレードしてくれと出ているので言われたとおりコマンドを実行
$ circleci switch Thank you for your interest in trying the new CLI! Be sure to read the docs if you get stuck. [https://github.com/CircleCI-Public/circleci-cli#readme] Are you sure you're ready to upgrade? [y/N]: y Upgrading CircleCI to the newest version. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1138 100 1138 0 0 4169 0 --:--:-- --:--:-- --:--:-- 4183 Finding latest release. Downloading CircleCI v0.1.1568 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 632 0 632 0 0 884 0 --:--:-- --:--:-- --:--:-- 885 100 3409k 100 3409k 0 0 567k 0 0:00:06 0:00:06 --:--:-- 842k x LICENSE x README.md x circleci Installing to /usr/local/bin/circleci /usr/local/bin/circleci $ circleci -h This project is the seed for CircleCI's new command-line application. Usage: circleci [command] Available Commands: config Operate on build config files diagnostic Check the status of your CircleCI CLI. help Help about any command local Debug jobs on the local machine namespace Operate on namespaces orb Operate on orbs query Query the CircleCI GraphQL API. setup Setup the CLI with your credentials update Update the tool version Display version information Flags: -h, --help help for circleci --host string URL to your CircleCI host (default "https://circleci.com") --token string your token for using CircleCI --verbose Enable verbose logging. Use "circleci [command] --help" for more information about a command.
もう一回チェックのコマンドを走らせるとさっきより詳細にエラーメッセージが表示されるようになった