< Back

M1MacでCircleCIのローカルビルド失敗する

ローカル環境で .circleci

このホームページみたらインストールできる
https://circleci.com/docs/ja/how-to-use-the-circleci-local-cli/

ビルド

コンフィグチェック

$ circleci config validate
Config file at .circleci/config.yml is valid.

pushしてこんなメッセージを何度も見た方は朗報です。

スクリーンショット 2023-10-13 12.55.55.png

ローカルでエラーが出ます。

$ circleci config validate
Error: config compilation contains errors: config compilation contains errors:
        - ERROR IN CONFIG FILE:

当該の問題

イシュー見る感じだと、ubuntuでもmacでも起こるっぽい?
https://github.com/CircleCI-Public/circleci-cli/issues/716

tmp読み込めない

$ circleci local execute {jobの名前}
(中略)
docker: Error response from daemon: Mounts denied: 
The path /tmp/3945127950_circleci_config.yml is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.

エラーメッセージ通りに、Dockerデスクトップの設定 Preferences -> Resources -> File Sharing で /tmp/ を追加する。

/tmp/{数値}_circleci_config.yml 数値は毎回変更されるので /tmp/ で設定。

ymlファイルがディレクトリとして認識される

$ circleci local execute {jobの名前}
(中略)
Error: failed to start event processor: failed to compute task config: failed to read config file: read /tmp/local_build_config.yml: is a directory

原因と解決策

イシューの最後にもかかれていますが /tmp というパスの競合でゴニョゴニョしてるみたいでした。https://github.com/CircleCI-Public/circleci-cli/pull/967 のPRを待つか、このPRをローカルビルドすれば動くかなと思います。

Thanks everyone for reporting this issue and contributing in the comments!

The underlying problem comes from Lima not accepting /tmp as a mount for its VMs, as it considers it a "system path" similar to /etc or /usr.. Any container distribution using Lima will face this issue, including colima and Rancher Desktop.

We're currently at work on this, and we seem to have found a solution in #967.
We're still working on adding some tests and checks to make sure this is reliable and future-proof, and we'll release it as soon as we can.
https://github.com/CircleCI-Public/circleci-cli/issues/716#issuecomment-1680680789

自分は一旦ローカルのconfigがバリデーションエラーでないかチェックするだけで充分だと思ったのでそれだけを使う予定です。