10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CircleCIでcheckoutすると日本語ファイルがpullできない問題を解決する

Posted at

問題

CircleCIで、アプリケーションのソースコードをcloneするには checkout というコマンドを使う。

.circleci/config.yml
version: 2.0
jobs:
  build:
    docker:
      - image: circleci/node:lts
    steps:
      - checkout # << これ
      - run:
          name: The First Step
          command: |
            echo 'Hello World!'
            echo 'This is the delivery pipeline'

その際、ファイル名に日本語などマルチバイト文字が含まれていると、 No such file or directory と怒られて失敗してしまう。


====>> Checkout code
  #!/bin/bash -eo pipefail
mkdir -p /home/circleci/project && cd /tmp/_circleci_local_build_repo && git ls-files | tar -T - -c | tar -x -C /home/circleci/project && cp -a /tmp/_circleci_local_build_repo/.git /home/circleci/project
tar: "features/scenarios/お知らせ.js": Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Error: Exited with code 2
Step failed

原因

checkout の中で git ls-files をしているが、その際ファイル名がエスケープされてるのが原因っぽかった。


$ git ls-files

# (中略)
"features/scenarios/\343\202\244\343\203\263\343\202\275\343\203\274\343\202\267\343\203\263\343\202\260.js"
# (後略)

解決法

checkout の前に 'git config --global core.quotepath false' を実行して解決。

.circleci/config.yml

version: 2.0
jobs:
  build:
    docker:
      - image: circleci/node:lts
    steps:
      - run: 
          command: 'git config --global core.quotepath false'
      - checkout
      - run:
          name: The First Step
          command: |
            echo 'Hello World!'
            echo 'This is the delivery pipeline'

備考

絶対なんか別の方法あるやろと思いつつあんま調べてないのでなんかご存知の方はこっそり教えて下さい

10
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?