Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI not caching

I have the following gitlab ci yaml file:

image: steveedson/ci

stages:
  - build

cache:
  untracked: true
  key: "$CI_PROJECT_ID"
  paths:
    - node_modules/
    - _site/vendor/
    - .bundled/
    - .yarn

build:
  stage: build
  script:
    - ls -l
    - yarn config set cache-folder .yarn
    - yarn install
    - ...

When my successful builds finish, they show:

Creating cache 1970478...
Created cache

And when the next commit triggers a build, I get:

Checking cache for 1970478...
Successfully extracted cache

But the ls -l in my first step doesn't show the cached directories. I've tried caching the cache key but this doesn't help.

This is running on gitlab.com, not a private server.

like image 861
SteveEdson Avatar asked Jan 05 '17 11:01

SteveEdson


People also ask

Where is GitLab CI cache?

By default, the cache is stored in the same place where GitLab Runner is installed. If the distributed cache is configured, S3 works as storage.

What is cache key in GitLab CI?

Caching in GitLab CI/CD (FREE) A cache is one or more files that a job downloads and saves. Subsequent jobs that use the same cache don't have to download the files again, so they execute more quickly.

How long does GitLab cache last?

all tiers. self-managed. By default, GitLab caches application settings for 60 seconds.


1 Answers

So, my configuration is correct, and Gitlab does support caches between jobs, however they have not added this to shared runners on gitlab.com, yet.

The issue is here https://gitlab.com/gitlab-com/infrastructure/issues/919 and should be added soon.

like image 166
SteveEdson Avatar answered Oct 02 '22 18:10

SteveEdson