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

Need ability to "copy" POLICY_FILE from one POLICY_GROUP to another #844

Open MrCyrus opened 4 years ago

MrCyrus commented 4 years ago

Describe the Enhancement:

Need the ability to copy POLICY_FILE from one POLICY_GROUP to another making pipelining easier.

Would be nice to have a command something like: chef copy SRC_POLICY_GROUP DST_POLICY_GROUP [POLICY_FILE]

Details

I've an environment containing 3 POLICY_GROUPs of:

So I've a pre-generated Policyfile.lock.json file that already has all dependent cookbooks information contained in it, yet unfortunately 'chef push' requires a local cache of dependent cookbooks (appearing to ignore the information already contained in Policyfile.lock.json) and will not/does not get the needed dependencies from the Chef Infra server

Describe the Need:

Any user using Chef in a pipelined (Jenkins) environment where full automation is desired. Especially a pipelined environment where random slave-servers might get run in the pipeline meaning that there is no expectation that a slave-server might have pre-cached dependent cookbooks.

Current Alternative

I've attempted to save a version of our policy cookbook in AWS S3 for each or our POLICY_GROUPs, so when I want to "copy" from "sandbox" to "dev-test" I just use the "sandbox" version of the policy cookbook and its pre-generated Policyfile.lock.json file, but this isn't working since none of the dependent cookbooks are found in the /home/jenkins/.chef-workstation/cache since I've no way to guarantee which jenkins-slave might get used in the pipeline. Currently looks like I'm going to be forced to put into Jenkins steps to somehow populate the cache files

Can We Help You Implement This?:

Aha! Link: https://chef.aha.io/features/SH-2704

afiune commented 4 years ago

@MrCyrus Thank you for filing this issue. We think that the other issue you filled https://github.com/chef/chef-workstation/issues/843 is the cause of the problem and this card is more like a feature request, we appreciate the initiative, we will go ahead and close the other issue and focus on this one instead, if you think that was not correct from your point of view, let us know.

danielcbright commented 4 years ago

This is a fantastic feature request, I have a feeling it can be done using knife raw, however I haven't tried that yet, I think a mechanism to promote policies without having to do a push each time would be a very beneficial addition to our toolkit.