Make Chef Server distributable under a configurable name - wordmarks in outputs
Motivation
As a Chef Infra redistributor, I would like to be able to redistribute Chef Infra server under a configurable name in order to make 3rd party distributions easier to produce and maintain in compliance with Chef Software's policy on trademarks https://www.chef.io/trademark-policy/
Specification
In other Chef Software repositories, we've adopted an approach wherein we create a file with constants in it (dist.rb in chef/chef) that correspond to Chef's wordmarks. We then replace all user-facing references to the wordmarks in the codebase with the constants. This allows 3rd party distros like Cinc.sh to build the code under new branding by swapping out the dist file and performing minor tweaks to the Omnibus conf.
Another approach also exists for Golang projects. Salim Afiune cooked up a a go code generator that's being implemented in Chef's go projects (see chef/go-libs for a full implementation + the code generator proper). When building, 3rd party distros simply feed a URL to a JSON file with their distro's wordmark replacements into go generate and then run plain old go build.
Original design proposal in chef/chef, which was re-used in multiple projects: https://github.com/chef/chef/issues/8376
Initial PR implementing dist.rb in chef/chef: https://github.com/chef/chef/pull/8368
The go code generator: https://github.com/chef/go-libs/tree/master/distgen
Let me know if I can provide any additional info about existing implementations of dist stuff, or if you want to explore an altogether different approach.
Downstream Impact
Somewhere between "none" and "everything" o.O For example, in chef/chef, we had a few situations that required changes beyond log messages and CLI outputs, such as having to rename the configuration directories. In the client repo, we addressed such concerns as we went, and ultimately managed to avoid breaking changes (altho a few deprecations resulted from the distro work). The bulk of the work should have no impact however, as it consists mostly of string replacements happening outside of logic and flow-control.
I have created an initial PR for review on this. It builds for me locally, but this is nowhere near a complete fix. Notably missing is anything outside the ruby code, and I focused on replacing chef-server and chef-server-ctl but there are probably many instances of chef still in the codebase which will need additional PRs.
I do not have buildkite set up but I did an Omnibus build and the resulting package appeared to be a fully functional Chef server. I can't get tests to run locally even when just building on the master branch so I may need help there from someone in Slack.
Coming back to this finally. At last check the smoke tests were failing with uninitialized constant Chef::Dist::Server from a recipe at cookbooks/private-chef/recipes/default.rb:25. I had refactored the wordmarks to use a cookbook attribute for everything under cookbooks and am now trying to ensure all tests pass.
Latest work is here: https://github.com/jgitlin-p21/chef-server/tree/jgitlin-p21/wordmarks
New PR for an initial pass here. Now with passing tests!
I now have an updated PR for the first round of wordmark replacements: https://github.com/chef/chef-server/pull/2808