在使用 Packer 的食谱中,是否有关于将 Chef Code 放在哪里的约定?

Is there a convention for where to put Chef Code, in a cookbook that uses Packer?

我正在与 Packer、Chef 和 Test Kitchen 一起工作(使用 ServerSpec)。我想出了厨房;它测试了我的食谱,我很高兴。现在我正尝试 运行 Packer 在同一个存储库中,在根目录中。 Most of the examples 指向 [cookbooks],但 repo 是一本食谱,根目录中有 metadata.rbBerksfile。 Packer .json 文件也在那里。

这些目录需要分开吗?当我执行 Packer 运行 时,它找不到我的 Chef 食谱并永远挂起。缩写示例:

packer.json

...
"provisioners":
[
  {
    "type": "chef-solo",
    "cookbook_paths": ["./"],
    "run_list": ["cookbook-name::default"]
  }
]

metadata.rb

name 'cookbook-name'
version '0.0.1'

depends 'git', '~> 6.0.0'

recipes/default.rb

include_recipe 'git'

您需要使用 berks vendor 之类的东西来写出完整的食谱文件夹,然后将 Packer 瞄准那个。