Gitlab CI not caching
Asked Answered
T

2

20

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.

Trudytrue answered 5/1, 2017 at 11:29 Comment(1)
Note: Shared runners in Gitlab doesn't support cache between jobs/pipelines.Dinar
T
6

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.

Trudytrue answered 5/1, 2017 at 17:6 Comment(3)
It's not for me either but I'm using a specific runner not a shared one :/Leone
On Gitlab.com, or a private instance?Trudytrue
Privately. It came out that the Runner 9.0 has a bug. 9.0.1 fixes it. Generally handling caches in docker executor failed. gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/…Leone
J
0

Caching doesn't seem to work if you run your config locally with something like: sudo gitlab-runner exec docker tests --docker-image "image/image"

Once I tested this through my Gitlab instance caching was working.

Joellajoelle answered 19/6, 2018 at 18:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.