【发布时间】:2021-11-16 16:57:06
【问题描述】:
我有一个在我的 GitLab 中运行的 CI 作业列表,但缓存没有按预期工作:
这就是我的文档生成工作的结束方式:
[09:19:33] Documentation generated in ./documentation/ in 4.397 seconds using gitbook theme
Creating cache angular...
00:02
WARNING: frontend/node_modules: no matching files
frontend/documentation: found 136 matching files
No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.
Created cache
Job succeeded
然后我开始部署作业(到 GitLab 页面)但它失败了,因为它没有找到文档文件夹:
$ cp -r frontend/documentation .public/frontend
cp: cannot stat 'frontend/documentation': No such file or directory
这是一代的缓存配置:
generate_docu_frontend:
image: node:12.19.0
stage: build
cache:
key: angular
paths:
- frontend/node_modules
- frontend/documentation
needs: ["download_angular"]
这是用于部署的:
deploy_documentation:
stage: deploy
cache:
- key: angular
paths:
- frontend/node_modules
- frontend/documentation
policy: pull
- key: laravel
paths:
- backend/vendor
- backend/public/docs
policy: pull
有人知道为什么我的文档文件夹丢失了吗?
【问题讨论】:
-
看起来您的共享缓存配置有问题...
No URL provided, cache will be not uploaded to shared cache server.。作为一种快速解决方法,您可以确保两个作业使用相同的跑步者。 -
顺便说一句,我觉得你最好在这里使用artifacts。