GitLab缓存仅被拉至第一份工作

时间:2019-01-07 20:46:06

标签: gitlab

我觉得我缺少什么。当我尝试使用配置为s3的GitLab缓存时,似乎只有管道中的第一个作业会使用它。

yarn_install:
  stage: update_deps
  image: xxxxx.com:8080/neo:latest
  tags:
    - docker2
  before_script:
    - yarn install
  script:
    - echo 'Done'

build:
  stage: build
  image: xxxxx.com:8080/neo:latest
  except:
    - master
  cache:
    policy: pull
  before_script:
    - yarn install
  script:
    - yarn build:s3 --base-href=/${CI_COMMIT_REF_SLUG}/
  tags:
    - docker2
  artifacts:
    expire_in: 15 min
    paths:
      - dist/

yarn_install作业中,我得到以下输出:

Running with gitlab-runner 11.6.0 (f100a208)
  on super-master 304fb8b1
Using Docker executor with image xxxxx.com:8080/neo:latest ...
Pulling docker image xxxxx:8080/neo:latest ...
Using docker image sha256:309a1c0a18dfa8bfa7e74227d23a48687eb2453c7c91de023ff6cb9eeec49f68 for xxxxx.com:8080/neo:latest ...
Running on runner-304fb8b1-project-64-concurrent-0 via runner-304fb8b1-neo-gitlab-docker-machine-1546891306-43e68036...
Cloning repository...
Cloning into '/builds/xxxxx/neo2.0'...
Checking out 00e8f4f5 as u/xxxxx/update-runners...
Skipping Git submodules setup
Checking cache for u-cdavis-update-runners-12...
Downloading cache.zip from https://xxxxx.s3-us-west-2.amazonaws.com/project/64/u-xxxxx-update-runners-12 
Successfully extracted cache
$ yarn install
yarn install v1.12.3
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.51s.
$ echo 'Done'
Done
Creating cache u-xxxxx-update-runners-12...
node_modules/: found 57196 matching files          
Uploading cache.zip to https://xxxxx.s3-us-west-2.amazonaws.com/project/64/u-cdavis-update-runners-12 
Created cache
Job succeeded

如您所愿,它明确表示已下载缓存,并将其提取。

然后下一个工作:

Cloning repository...
Cloning into '/builds/xxxxx/neo2.0'...
Checking out 00e8f4f5 as u/xxxxx/update-runners...
Skipping Git submodules setup
$ yarn install
yarn install v1.12.3

似乎跳过了这一步。

我的缓存是在顶级定义的:

cache:
  key: "$CI_COMMIT_REF_SLUG"
  paths:
  - node_modules/

0 个答案:

没有答案