Need help compiling ChefDK

Hi!

I am trying to create a platform specific package for ChefDK. When I run the command below ...

$ bundle exec omnibus build chefdk

I get this error ...

bundler: failed to load command: omnibus (/usr/local/bin/omnibus)
Gem::Exception: can't find executable omnibus for gem omnibus. omnibus is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
  /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:462:in `block in replace_bin_path'
  /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
  /usr/local/bin/omnibus:23:in `<top (required)>'

even if I have it installed.

# gem list | grep omnibus

**omnibus** (6.1.9)

What am i doing wrong?

Regards,
J

Might want to take a look at chef-workstation. It supersedes ChefDK.

Without addressing the specific issue you're hitting, the best suggestion I can give is to run the included test kitchen stuff (ie converge the centos-7 box; the kitchen.yml file is in the omnibus directory) and watch what it does.

That's not intended to be glib advice. I've spent the last few weeks trying to compile workstation and chef client. There's a bunch of [undocumented?] setup stuff done during that TK converge that I didn't know about or still haven't been able to match independently. Before realizing TK was set up to configure a VM environment, I wasted way too many hours trying to follow the limited build instructions which mostly dead-ended in tracking down ghosts and shadows - everything from make not compiling to rubyzip gem is not installed

omnibus-toolchain seems like it's a pre-req for compiling other chef stuff, but I'm still trying to figure out exactly how it fits in.

Here's a quick and dirty overview of omnibus builds, assuming you're building for a non-supported platform:

  1. Get a recent Ruby installed and add it to your path, most Chef projects are currently 2.6.6, moving to 2.7 in progress.

  2. Build and install omnibus-toolchain and add it to your PATH, so you have the fully-self-contained tool versions for building Chef projects.

  3. Download the Chef project you're trying to build (ie. ChefDK or Chef Workstation).

  4. Bundle install the dependencies for that project, this will bring down omnibus.

  5. bundle exec omnibus build $PROJECT, which will eventually pop out a package of what you built.

I make Raspberry Pi builds of the Chef Client, here's the script I used for building packages for Debian-based Chef 14.15.6 a few days ago:

https://github.com/mattray/mattray.github.io/blob/master/assets/DEB-chef-14.15.6.sh

More details here: https://mattray.github.io/2020/04/10/chef-14-on-arm.html

Chef's official CI/CD pipelines don't use the same techniques, they have the advantage of being able to bootstrap via Chef and cache a ton, because they can use existing supported builds. Best of luck!

Thanks,
Matt Ray
Regional Manager, Customer Architect - APJ :: Chef
matt@chef.io

AUS: +61 0457 231 372

US: +1 512 731 2218
mattray :: GitHub :: Slack :: Twitter

ChefConf 2020

thanks @MattRay. That helps. Have been working on a script that looks quite similar to yours. Good to know I was heading in the general direction.

I think one thing that's confusing about omnibus-toolchain is that it builds into /opt/omnibus-toolchain, but to actually use the toolchain (ie to build chefdk/workstation), it still has to be installed via the package (rpm here, but deb is same) that was created during the build. This installs to the same location. When I ran it through TK, I saw that the converge had set up a bunch of additional symlinks in /opt/omnibus-toolchain/bin. After seeing what TK did, it seems somewhat obvious that just building the toolchain isn't enough?

It looks from your script like you run into something similar and have to clean up /opt/omnibus-toolchain before installing the package (line 46)?

sudo rm -rf /opt/omnibus-toolchain

That is correct. I build the omnibus-toolchain package, clean up after the build, and install the package I just built.

Thank you @MattRay and @smokeh! I shall try.