asp.net-core - Gitlab CI : Skipping cache archiving due to empty cache key

标签 asp.net-core continuous-integration gitlab node-modules gitlab-ci

我无法在 gitlab ci 脚本中为 .NET core 和 angular 项目缓存 node_modules。

我收到此消息 Skipping cache archiving due to empty cache key

这是我的 CI 作业

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/'

最佳答案

我在使用 C++ 构建的 Windows 运行程序时遇到了同样的问题。无论我在 .config-ci.yml 文件中设置什么,我都无法缓存我的第三方库构建。

事实证明,问题是我的 Gitlab 运行程序设置在 config.toml 中没有 cache_dir。一旦我设置了它,我的 .config-ci.yml 文件中的简单缓存设置就会按预期工作。

不幸的是,该错误误导了哪个配置文件中缺少哪个 key 。

关于asp.net-core - Gitlab CI : Skipping cache archiving due to empty cache key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61320812/

相关文章:

heroku - CI 环境中的脚本 "heroku login"

git - CI 自动化/Jenkins - 如果 pull 请求分配了标签(或其他条件),则不要触发构建

haskell - 用于集中式 Haskell/Darcs 工具链的轻量级持续集成?

gitlab - 如何使 gitlab 激活的特定运行器工作?

c# - 在路由属性中添加默认操作

linux - 在后台运行 K Kestrel

c# - Entity Framework 7 回滚方法

c# - 对象的模型绑定(bind)集合作为 ASP.Net Core MVC 中模型的一个属性

gitlab - 如何在我的私有(private)仓库中添加 GitLab 中的公共(public)协作者

linux - 为 gitlab-runner 设置权限