Par*_*gun 1 caching gitlab-ci gitlab-ci-runner
Not uploading cache {name of branch} due to policy我的 gitlab 运行程序出现错误。我的.yaml文件如下所示:
stages:
- test
- staging
- publish
- deploy
# cache using branch name
# https://gitlab.com/help/ci/caching/index.md
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .yarn
- node_modules/
policy: pull
before_script:
- yarn install --cache-folder .yarn
test:
stage: test
image: node:14
script:
- yarn install
- yarn test
pages:
stage: staging
image: alekzonder/puppeteer
except:
- master
script:
- yarn install
- yarn compile
- yarn build
publish:
stage: publish
image: alekzonder/puppeteer
when: manual
script:
- yarn install
- yarn compile
- yarn build
artifacts:
paths:
- dist
deploy:
image: google/cloud-sdk:latest
stage: deploy
needs:
- publish
script:
- gcloud auth activate-service-account --account ${GCP_SERVICE_ACCOUNT} --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
- gsutil -u test rsync -r -d dist/ gs://test.ca
Run Code Online (Sandbox Code Playgroud)
您有以下集合:
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .yarn
- node_modules/
policy: pull
Run Code Online (Sandbox Code Playgroud)
这开创了管道全局先例,您只想policy: pull从缓存中 ( ) 提取。
您需要阅读https://docs.gitlab.com/ee/ci/yaml/#cachepolicy
如果您省略这一policy:部分,则默认为pull-push(这将使您的缓存上传)。
不过,我的管道结构往往与你的略有不同。我通常有一个定义的“准备”步骤,然后运行一次yarn install:
"Installing Dependencies":
image: node:lts
stage: Prep
cache:
paths:
- .yarn
- node_modules/
policy: pull-push
script:
yarn install
...
Run Code Online (Sandbox Code Playgroud)
注意:然后您可以保留“拉”的全局策略,因为这项作业将覆盖“拉-推”。
然后,您可以删除yarn install所有其他任务上的 ,因为缓存将被恢复。
| 归档时间: |
|
| 查看次数: |
3333 次 |
| 最近记录: |