chef / chef-workstation

Chef Workstation gives you everything you need to get started with Chef, so you can automate how you audit, configure, and manage applications end environments.
Apache License 2.0
134 stars 112 forks source link

Migrate knife supermarket to chef supermarket #2303

Open tas50 opened 3 years ago

tas50 commented 3 years ago

We should move the Ruby based knife supermarket commands to the chef CLI. The goal here is to mostly replicate existing behavior with some important differences.

Current knife commands

knife supermarket download COOKBOOK [VERSION] (options)
knife supermarket install COOKBOOK [VERSION] (options)
knife supermarket list (options)
knife supermarket search QUERY (options)
knife supermarket share COOKBOOK [CATEGORY] (options)
knife supermarket show COOKBOOK [VERSION] (options)
knife supermarket unshare COOKBOOK

New Commands

chef supermarket download ARTIFACT_TYPE ARTIFACT_NAME [VERSION] (options)
chef supermarket install ARTIFACT_TYPE ARTIFACT_NAME [VERSION] (options)
chef supermarket list ARTIFACT_TYPE (options)
chef supermarket search ARTIFACT_TYPE QUERY (options)
chef supermarket share ARTIFACT_TYPE ARTIFACT_NAME (options)
chef supermarket show ARTIFACT_TYPE ARTIFACT_NAME [VERSION] (options)
chef supermarket unshare ARTIFACT_TYPE ARTIFACT_NAME

Artifact Type

The main difference in the implementation as we move knife supermarket commands to chef supermarket is the concept of an artifact type. knife supermarket assumes that the user is searching, sharing, or downloading a cookbook. chef supermarket will allow either cookbooks or profiles. This requires us to have a positional parameter for the artifact type. For example:

knife supermarket download foo becomes chef supermarket download cookbook foo

More Intelligent Share

Right now knife supermarket share command requires the user to define their cookbook path in the knife.rb config file and this relies on a monolithic chef-repo setup with a dedicated cookbooks directory. We don't want to require the cookbooks path anymore. The command needs to be more intelligent about sharing in general.

When the user runs knife cookbook share without a cookbook name we should assume they want to share the cookbook in the current directory. If there's a metadata.rb file then share the current cookbook.

When the user runs knife cookbook share foo check the following locations:

Technical Questions:

kasif-adnan commented 3 years ago

Hello @tas50 , here are few questions from team :

vkarve-chef commented 3 years ago

Thanks for sharing the notes, @kasif-adnan! ...the team will figure out answers to most Q's. the only input we need from product management is on the second Q i.e. "As part of this ticket does knife supermarket implementation needs to be enhanced as well ? Could do this, but why if we are eventually deprecating ?"