Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI : Skipping cache archiving due to empty cache key

I can't caching node_modules for .NET core and angular project in gitlab ci script.

I have this message Skipping cache archiving due to empty cache key

here is my CI JOB

build_job:
  stage: build
  except:
    refs:
      - tags
  tags:
    - windows
  script:
    - dotnet restore .\$CI_PROJECT_NAME.sln
    - dotnet build /p:Version=${env:VERSION} -c Release --no-restore /nr:false
  artifacts:
    name: "build-$CI_COMMIT_REF_NAME"
    paths:
      - '$CI_PROJECT_NAME/'
      - '$CI_PROJECT_NAME.Tests/'
  cache:
    key: ${CI_COMMIT_REF_SLUG}-node
    paths:
      - './$CI_PROJECT_NAME/ClientApp/node_modules/'
like image 393
Asakkour Soufiane Avatar asked Oct 26 '25 21:10

Asakkour Soufiane


1 Answers

I was having the same problem for my Windows runner with a C++ build. No matter what I set in my .config-ci.yml file I could not get my third party library builds cached.

In turns out the problem was that I did not have a cache_dir in the config.toml for my Gitlab runner settings. Once I set this, the simple cache settings in my .config-ci.yml file worked as desired.

Unfortunately the error is misleading as to which key in which configuration file is missing.

like image 157
Andy Schmidt Avatar answered Oct 29 '25 14:10

Andy Schmidt