我遇到了gitlab CI缓存的意外行为。 我不理解为什么 build 作业为什么不向其缓存路径添加-node_modules / ,因为脚本 gitlab-build 依赖于它。
例如,如果 test 作业缓存路径下没有 node_modules / ,则应用失败。我认为在这种情况下会失败,但不能真正理解为什么 build 作业缓存路径中不存在 node_modules / 时CI不会失败的原因。
stages:
- test
- build
lint:
stage: test
before_script:
- npm install
script: "./scripts/gitlab-lint"
cache:
untracked: true
key: "calfe"
paths:
- node_modules/
test:
stage: test
script: "./scripts/gitlab-test"
cache:
key: "calfe"
paths:
- node_modules/
policy: pull
build:
stage: build
script: "./scripts/gitlab-build"
cache:
key: "calfe"
paths:
- build/