Appbundle-updater and kitchen-appbundle-updater and appbundler 0.5.0 changes


#1

Recently appbundler was updated to release 0.5.0 which changes how apps
inside of the omnibus chef and chef-dk packages are appbundled:

Previously, you could git checkout the chef repo into
/opt/chefdk/embedded/apps/chef and then command line tools like
knife/chef-client/etc would pick up the version out of that directory,
instead of going to the gem library version under
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/[…etc…]

With the 0.5.0 release of appbundler that changes and while we’re still
going to be shipping bundles which have code checkouts under the 'apps’
directory, at runtime the commands will load gems only out of the gem
library.

This is arguably more ruby-like that the prior behavior and probably a
good direction to head in, but it may be confusing to users that got
used to how we did things between chef 12.0->12.4.x (and for all the
chef-dk releases prior to 0.9.0).

This also broke both kitchen-appbundle-updater and fletcher’s
chefdk-updater script. Both of those are designed to allow doing git
checkouts over appbundled chef and chef-dk packages in order to update
apps in those omnibus bundles.

We use kitchen-appbundle-updater in order to install the current omnibus
chef package and then upgrade it to git master in order to test
cookbooks against master code in travis.

Over the past week I fixed both of those.

The chefdk-updater script has been renamed ‘appbundle-updater’ and
released as a gem:

Typical usage is pretty simple and covered in the README, in order to
install chef master into a chef-dk omnibus package:

% gem install appbundle-updater
% sudo appbundle-updater chefdk chef master

That will leave a git checkout in /opt/chefdk/embedded/apps/chef,
although you’ll have to ‘rake install’ it into the gem library if you
make any modifications (again, a change from the prior behavior).

There is also a --tarball flag which will download a github tar.gz file
and extract it instead of doing a checkout:

% gem install appbundle-updater
% sudo appbundle-updater chefdk chef master --tarball

This has the advantage that it is pure ruby, uses only the ruby stdlib,
and should be portable to everywhere that omnibus-chef is ported (only
tested on Windows and Ubuntu, but I suspect that AIX and Solaris should
work out of the box). Without the --tarball flag, you would need to
install the git command line tool on your image first.

I’ve also released a new version of kitchen-appbundle-updater which now
uses appbundle-updater with the --tarball option to allow easily testing
against chef master.

After installing/bundling the gem the .kitchen.yml format remains
unchanged from previous versions, use the ‘chef_github’ provisioner and
the following config options (which are the defaults and can be omitted
if you want to just track master):

provisioner:
name: chef_github
github_owner: "chef"
github_repo: "chef"
refname: “master”

This should also be portable across Windows and any Unix out there which
TK supports.

TL;DR: If you want to use omnibus chef/chef-dk and hack on chef master
these gems are what you want to use. If you already were doing this,
the new version of appbundler will change how things work a bit but
these gems automate around that. The new gems are designed to be
extremely portable. If you don’t care about getting chef master into
omnibus bundles (the vast majority of Chef users) you can safely ignore
this wall of text.