limitusus’s diary

主に技術のことを書きます

HOWTO: release Chef cookbooks

tl;dr

Use stove.

I tried to release a new version of chrony_ii cookbook in the same way I used to, but it did not succeed.

I found that the subcommand I was using is now deprecated, so I determined to use the dedicated tool for that.

Problem I faced

I was releasing public cookbooks with the following command in the cookbook directory (/path/to/cookbooks, not /path/to/cookbooks/my_cookbook):

$ COOKBOOK_NAME=chrony_ii
$ chef exec knife cookbook site share ${COOKBOOK_NAME} -k ~/.chef/limitusus-chefio.pem -u limitusus -o .

The result is FAIL, as follows

Generating metadata for chrony_ii from /var/folders/hb/dzt5s4014wv6_nxjmkkmwd141dqz8q/T/chef-chrony_ii-build20190321-12141-12lhjc1/chrony_ii/metadata.rb
Making tarball chrony_ii.tgz
ERROR: Multipart POST part 'tarball' is corrupt: "\x80\x00\x00\x00\x02\xDB\xFD\x17" is not an octal string

While investigating the cause of this error I found the subcommand "knife cookbook site" is deprecated and we should use knife supermarket instead.

docs.chef.io

I replaced knife cookbook site with knife supermarket but the error unchanged.

stove: packaging & releasing Chef cookbooks

Next I found supermarket document page:

docs.chef.io

then I tried using stove

github.com

It simply worked, and no output (with --no-git, as I have already tagged), but the cookbook is successfully uploaded.