【发布时间】:2020-04-27 15:17:30
【问题描述】:
C:\git\test (master) × berks --version
7.0.8
我对 Berkshelf 解决链式 git 依赖项有疑问。
我生成了一个测试食谱来缩小问题范围,这本食谱依赖于食谱 windows-automation 通过 git 参考。
测试 Berksfile
# frozen_string_literal: true
source 'https://supermarket.chef.io'
cookbook 'win-telegraf', path: '../win-telegraf/'
cookbook 'windows-automation', '~> 0.4.0', git: 'git@git.osky.io:ops/chef-windows-automation.git', branch: 'master'
# cookbook 'windows-library', '~> 0.1.0', git: 'git@git.osky.io:ops/chef-windows-library.git', branch: 'master'
metadata
测试元数据.rb
depends 'win-telegraf'
depends 'windows-automation', '~> 0.4.0'
# depends 'windows-library', '~> 0.1.0'
windows-automation 通过另一个 git 引用依赖于 windows-library
windows-automation Berksfile
source 'https://supermarket.chef.io'
metadata
cookbook 'powershell', '~> 6.1.3'
cookbook 'windows', '~> 4.2.5'
# cookbook 'windows-library', path: '../chef-windows-library'
cookbook 'windows-library', '~> 0.1.0', git: 'git@git.osky.io:ops/chef-windows-library.git', branch: 'master'
Windows 自动化元数据
supports 'windows'
depends 'powershell', '~> 6.1.3'
depends 'windows-library', '~> 0.1.0'
当我尝试为测试说明书运行 berks install 时出现此问题。我得到以下输出
C:\git\test (master) × berks install
Resolving cookbook dependencies...
Fetching 'test' from source at .
Fetching 'win-telegraf' from source at ../win-telegraf
Fetching 'windows-automation' from git@git.osky.io:ops/chef-windows-automation.git (at master)
Fetching cookbook index from https://supermarket.chef.io...
Unable to satisfy constraints on package windows-library, which does not exist, due to solution constraint (test = 0.1.0). Solution constraints that may result in a constraint on windows-library: [(test = 0.1.0) -> (windows-automation = 0.4.0) -> (windows-library >= 0.0.0)], [(windows-automation = 0.4.0) -> (windows-library >= 0.0.0)]
Missing artifacts: windows-library
Demand that cannot be met: (test = 0.1.0)
Unable to find a solution for demands: test (0.1.0), win-telegraf (0.1.0), windows-automation (0.4.0)
如果我在测试说明书中添加了对 windows-library 的依赖项,此问题将得到解决。但我想知道为什么没有依赖关系,berkshelf 无法解决这个问题。我觉得我不需要显式地依赖所有 transative git 依赖项。
【问题讨论】:
标签: berkshelf