-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include metadata.rb
#59
Include metadata.rb
#59
Conversation
Without this file stove does not conform to the same specs as `knife cookbook site share COOKBOOK` and this causes issues with later steps in the workflow. For example, `knife cookbook site install COOKBOOK` will fail for some cookbooks as it reads the `metadata.rb` to resolve dependencies.
Hey @nathenharvey, I actually just removed this functionality in v3.2.3 (193d7c4), and I think Consider Chef Sugar's metadata: name 'chef-sugar'
# ...
require File.expand_path('../lib/chef/sugar/version', __FILE__)
version Chef::Sugar::VERSION This design decision is because the Chef Sugar cookbook is versioned with the Chef Sugar gem. Otherwise I risk (and have mistakenly in the past) releasing inconsistent versions between the cookbook and the gem. The problem with uploading the compiled metadata is that it is interpreted upon download. Not only is this dangerous (upload this file to Supermarket and then # metadata.rb
name "foo"
print "I need your password to install this cookbook:"
system "sudo rm -rf /" but it also means the metadata has an external dependency. When I say "dependency", I don't mean name "foo"
version `git ...` This is actually impossible because the git command will be run and calculated at download. Furthermore, there is no guarantee that git even exists on the target system. This would "work on my machine", but could fail on anyone else who isn't in the same environment. One more example: name "foo"
maintainer ENV["USER"] On my machine, this prints "sethvargo". I'm certain yours would print "nathen" or "nathenharvey". When I install this cookbook, the maintainer will be "sethvargo". When you install this cookbook, the maintainer will be "nathenharvey". Hey, you stole my cookbook! 😄 This is because these values are interpreted. By now I hope it's abundantly clear what interpreting the metadata is a bad idea. Compiled metadata is the proper solution. @reset and I have been preaching this for two years now 😄. The compiled metadata will include the data that was generated for those values at the time of upload. It is static data and is not dependent on an outside system. For Chef Sugar, that looks like this: {
"name": "chef-sugar",
"version": "3.2.3"
} For a git-sha version, that could look like this: {
"name": "foo",
"version": "abcd1234"
} Now, to the nuts and bolts:
I'm am 100% certain that statement is true. I am totally able to reproduce that issue locally:
However, I think this is a bug that needs to be fixed in Chef. The rest of Chef core is designed to prefer the
This leads me to believe that So, as a compromise, I just decided to fix it for you. |
I have two open issues regarding this, a blog post, and a chef conf talk which all touch on this. It's a much bigger problem then the attention it's been afforded. It's a 100% oversight in the early design of chef before cookbooks began to become as reusable and distributable as they now are. To avoid problems, Berkshelf never uploads the metadata.rb, that way metadata.json is always preferred when a client downloads and evaluates a cookbook. |
Thanks, @sethvargo! Fixing both the consumer and producer side of this issue is the right way to go. With the current release of stove (> =3.2.3), the producer publishes cookbooks in a way that breaks the consumer ( @reset do you have links to the open issues? Perhaps we should open an RFC to fully deprecate the use of |
There's also these rejected/stale requests: And confusion from the community: And most importantly, here's Jamie's incredibly important discussion on the topic: http://blog.vialstudios.com/the-importance-of-compiled-metadata/ |
Blah. Why are those buttons so close together! |
Thanks, @sethvargo and @reset! |
@sethvargo thanks for getting him those links! @nathenharvey no prob, I hope that this can become a true discussion point for Chef 13 ;). We need it. |
Without this file stove does not conform to the same specs as
knife cookbook site share COOKBOOK
and this causes issues withlater steps in the workflow.
For example,
knife cookbook site install COOKBOOK
will fail forsome cookbooks as it reads the
metadata.rb
to resolve dependencies.