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/'
                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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With