Skip to content
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

Support Cookbook Uploads #250

Open
wheatevo opened this issue Jan 16, 2024 · 4 comments · May be fixed by #253
Open

Support Cookbook Uploads #250

wheatevo opened this issue Jan 16, 2024 · 4 comments · May be fixed by #253

Comments

@wheatevo
Copy link

As a user, I would like to be able to upload cookbooks using the go-chef/chef library.

Ruby Chef Cookbook Uploader: https://github.com/chef/chef/blob/main/lib/chef/cookbook_uploader.rb

General Process:

  • Parse local cookbook, generating checksums for all cookbook files.
  • Create a sandbox with the generated checksums to determine which files will need to be uploaded.
    • Use chef.Sandbox Post
  • Upload each cookbook file into the sandbox that has needs_upload set to true in the chef.Sandbox Post JSON response by performing a PUT to the provided sandbox item url.
  • Commit the sandbox.
    • Use chef.Sandbox Put
  • Upload the cookbook version manifest.
@wheatevo
Copy link
Author

I am currently taking a look at implementing this and submitting a PR.

@MarkGibbons
Copy link
Member

Cool. Just to note I've never been able to get the sandbox api client to work at all.

@wheatevo
Copy link
Author

wheatevo commented Jan 17, 2024

Cool. Just to note I've never been able to get the sandbox api client to work at all.

I haven't had any trouble with it so far, but it may be due to different Chef Server versions (I've been working with Chef Server 15). Were you seeing issues against Chef Server, CINC Server, or Goiardi?

@MarkGibbons
Copy link
Member

I usually test against the current chef server. The test suite for this project has a cookbook that spins up a chef server I run the integration tests against and where I do development. Good to hear you have it working.

wheatevo added a commit to wheatevo/chef that referenced this issue Jan 24, 2024
* Add support for cookbook uploads (V0 and V2).
* Add support for chefignore files
* Improve metadata.rb parsing to conform with Chef API
* Add ServerApiVersion customization to http
* Minor linting changes for newer golang versions

Resolves go-chef#250
wheatevo added a commit to wheatevo/chef that referenced this issue Jan 24, 2024
* Add support for cookbook uploads (V0 and V2).
* Add support for chefignore files
* Improve metadata.rb parsing to conform with Chef API
* Add ServerApiVersion customization to http
* Minor linting changes for newer golang versions

Resolves go-chef#250
@wheatevo wheatevo linked a pull request Jan 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants