当前,我正在使用AWS CodeBuild部署我的monorepo项目,并且正在尝试使用其缓存属性。我想缓存我的node_modules
文件夹,而我的buildspec.yml
是:
version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- npm install
finally:
- echo This always runs even if the update or install command fails
pre_build:
commands:
- echo Entered the pre_build phase...
finally:
- echo This always runs even if the login command fails
build:
commands:
- echo Entered the build phase...
- echo Build started on `date`
- npm run build
finally:
- echo This always runs even if the install command fails
post_build:
commands:
- echo "Entered the post_build phase (deploy)..."
- npm run deploy
- echo deploy completed on `date`
cache:
paths:
- 'node_modules/**/*'
- 'packages/lambdas/node_modules/**/*'
- 'packages/web/node_modules/**/*'
是否可以使用通配符将所有node_modules
添加到路径?
我的存储库结构是:
root
node_modules
packages
lambdas
node_modules
...
web
node_modules
...
...
谢谢!
更新1(05/14/16):
我收到此错误
[Container] 2019/05/14 23:19:24 Symlinking: /codebuild/output/src986466269/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/MYREPOSITORY/*/**/node_modules => /codebuild/local-cache/custom/7bd9b9fb12a6f74162020f29bfde2b34c52fdde87977fb9dda31fcbbb33f01af/*/**/node_modules
[Container] 2019/05/14 23:19:24 Error mounting /codebuild/output/src986466269/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/MY_REPOSITORY/*/**/node_modules: symlink /codebuild/local-cache/custom/7bd9b9fb12a6f74162020f29bfde2b34c52fdde87977fb9dda31fcbbb33f01af/*/**/node_modules /codebuild/output/src986466269/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/MY_REPOSITORY/*/**/node_modules: no such file or directory
当我使用
cache:
paths:
- '*/**/node_modules/**/*'