Chef

Table Of Contents

Community Contributions

We are glad you want to contribute to Chef! Here’s how:

  1. Review the Become a contributor page on Chef Supermarket and follow the steps described there for signing the contributor license agreement; both individuals and companies must sign the contributor licensing agreement unless the fix is an Obvious Fix
  2. Create a GitHub pull request
  3. Do a code review with the Chef team and/or core committers on the pull request

Chef regularly reviews contributions and will get back to you if we have any suggestions or concerns.

Chef-managed open source projects are located here: https://github.com/chef. See https://github.com/chef/chef/blob/master/CONTRIBUTING.md for more information about the contribution process itself. See below for more information about CLAs, the Apache license, and the obvious fix rule.

About CLAs and CCLAs

A contributor licensing agreement (CLA) and/or a company contributor licensing agreement (CCLA) must be filled out by every contributor to an Chef-managed open source project.

The CLA (and CCLA) makes everyone’s rights clear

  • You (or your company) grant copyright license for your contributions to Chef
  • You (or your company) grant patent license for your contributions to Chef
  • The contribution is entirely voluntary
  • The work is your original creation
  • You (or your company) are not required to provide support for your contributions
  • You (or your company) should read and understand the entire CLA (or CCLA) before signing it. Our description of it is not legally binding.

The CLA is beneficial to our contributors and users because:

  • It ensures that we will always be able to release our projects, free from any individual contributor revoking our rights to distribute their contribution.
  • This also means that, if you fork an Chef project, or utilize it in a commercial product, you know that you are clear of patent and copyright issues.
  • It makes clear what is required of our contributors.
  • The most important thing about the CLA is that it doesn’t give Chef any special rights - it just makes things more explicit.

Chef does not merge any pull requests made against an Chef-managed open source repository until that pull request is associated with a signed CLA (or CCLA), with two exceptions: “Obvious Fixes” and pull requests made against the documentation repository (https://github.com/chef/chef-docs).

About the Apache License

Chef uses the Apache License Version 2 because it provides the same level of freedom for our users that we desire for ourselves. Based upon the Apache Licensing FAQ, it allows you to:

  • freely download and use Chef software, in whole or in part, for personal, company internal, or commercial purposes;
  • use Chef software in packages or distributions that you create.

It forbids you to:

  • redistribute any piece of Chef-originated software without proper attribution;
  • use any marks owned by Chef in any way that might state or imply that Chef endorses your distribution;
  • use any marks owned by Chef in any way that might state or imply that you created the Chef software in question.

It requires you to:

  • include a copy of the license in any redistribution you may make that includes Chef software;
  • provide clear attribution to Chef for any distributions that include Chef software; attribution can be done in the NOTICE file for an application, by adding yourself as an author/copyright holder to the HEADER for an individual file, and by placing text in a header file saying that new work is based on previous work
  • reuse work as long as the licensing terms of the reused work remains unchanged (i.e. The Apache License Version 2 also applies to the reused work)

It does not require you to:

  • include the source of the Chef software itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it;
  • submit changes that you make to the software back to Chef (though such feedback is encouraged).

It is our goal to run a successful, truly open source business. To that end, we are protecting our own rights by making them explicit in our choice of licensing: you have the same rights to our open source software that we do.

The “Obvious Fix” Rule

Chef‘s contribution policy is aimed at encouraging broad participation from our community, and minimizing risks to Chef and our community due to inappropriate contributions of the intellectual property of others.

As a general standard, Chef requires every contributor to fill out a Contributor License Agreement (“CLA”), either individually or on behalf of a corporation.

HOWEVER, very small contributions such as fixing spelling errors, where the content is small enough to not be considered intellectual property, can be submitted by a contributor as a patch, without a CLA. If you submit an obvious fix without first signing a contributor license agreement, then you are agreeing that your submission is not independently copyrightable. The purpose of this exception is to lower the barrier for new contributors to make contributions while retaining the integrity of the project and our community.

How does the Obvious Fix Rule Work?

Any committer may commit fixes without first signing a CLA for obvious typos, grammar mistakes, and formatting problems wherever they may be — in the web pages, API documentation, source code, etc.

Whenever you invoke the “obvious fix” rule, please say so in your commit message. For example:

------------------------------------------------------------------------
commit 370adb3f82d55d912b0cf9c1d1e99b132a8ed3b5
Author: danielsdeleo <dan@chef.io>
Date:   Wed Sep 18 11:44:40 2013 -0700

  Fix typo in config file docs.

  Obvious fix.

------------------------------------------------------------------------

What qualifies as an Obvious Fix?

An obvious fix is a pull request that does not contain creative work. We rely on your judgment to determine what is “obvious”; if you’re not sure, just ask by sending an email to: oss AT getchef DOT com.

As a rule of thumb, changes are obvious fixes if they do not introduce any new functionality or creative thinking. As long as the change does not affect functionality, some likely examples include the following:

  • Spelling/grammar fixes;
  • Correcting typos;
  • Cleaning up comments in the code;
  • Changes to white space or formatting;
  • Bug fixes that change default return values or error codes stored in constants, literals, or simple variable types;
  • Adding logging messages or debugging output;
  • Changes to ‘metadata’ files like Gemfile, rebar.config, Makefile, app.config, sys.config, .gitignore, example configuration files, build scripts, etc.;
  • Changes that reflect outside facts, like renaming a build directory or changing a constant;
  • Changes in build or installation scripts;
  • Re-ordering of objects or subroutines within a source file (such as alphabetizing routines);
  • Moving source files from one directory or package to another, with no changes in code;
  • Breaking a source file into multiple source files, or consolidating multiple source files into one source file, with no change in code behavior;
  • Changes to words or phrases isolated from their context;
  • Changes to typeface.

Things that would still require signing a CLA before submitting would likely include stuff like the following:

  • Any of the above actions that result in a change in functionality;
  • A new feature;
  • A translation;
  • Extensive or creative comments.

Issues and Bug Reports

Issues and bug reports may be created for Chef, including the chef-client, the Chef server, the Chef Analytics platform, and the Chef management console. The following repositories are the preferred locations for the creation of issues and bug reports:

Repo URL
chef-client https://github.com/chef/chef
Chef Server https://github.com/chef/chef-server
Chef Manage https://github.com/chef/chef-manage-issues
Chef Analytics https://github.com/chef/chef-analytics
Chef Push Jobs https://github.com/chef/chef-push

For additional support about Chef, including documentation, learning, and opening tickets with the support team, see https://www.chef.io/support/.

Warning

If you require a response from Chef per the terms of a support level agreement (SLA), please contact support directly.

Use git

Chef is maintained on GitHub. To contribute to Chef, such as submitting a pull request, requires using GitHub and git. The sections below describe how to use git to set up the Chef repository, keep it current and synchronized, and how to use branches to submit pull requests.

Set Up Repo

Use the following steps to set up a development repository for Chef:

  1. Setup a GitHub account.

  2. Fork the https://github.com/opscode/chef repository to your GitHub account.

  3. Clone the https://github.com/opscode/chef repository:

    $ git clone git@github.com:yourgithubusername/chef.git
    
  4. From the command line, browse to the chef/ directory:

    $ cd chef/
    
  5. From the chef/ directory, add a remote named chef:

    $ git remote add opscode git://github.com/chef/chef.git
    
  6. Verify:

    $ git config --get-regexp "^remote\.chef"
    

    which should return something like:

    remote.chef.url git://github.com/chef/chef.git
    remote.chef.fetch +refs/heads/*:refs/remotes/chef/*
    
  7. Adjust your branch to track the opscode master remote branch:

    $ git config --get-regexp "^branch\.master"
    

    which should return something like:

    branch.master.remote origin
    branch.master.merge refs/heads/master
    

    and then change it:

    $ git config branch.master.remote chef
    

Keep Master Current

Use the following steps to keep the master branch up to date.

  1. Run:

    $ git checkout master
    
  2. And then run:

    $ git pull --rebase
    

The following rakefile can be used to update Chef, Ohai, and cookbooks. Edit as necessary:

projects = %w[chef cookbooks ohai]
chef = "#{ENV['HOME']}/projects/chef"

desc "Update local repositories from upstream"
task :update do
  projects.each do |p|
    Dir.chdir("#{chef}/#{p}") do
      sh "git fetch chef"
      sh "git rebase chef/master master"
    end
  end
end

Sync Master

Use the following steps to synchronize the master branch.

  1. Run:

    $ git fetch chef
    
  2. And then run:

    $ git rebase chef/master master
    

    Note

    Use rebase instead of merge to ensure that a linear history is maintained that does not include unnecessary merge commits. rebase will also rewind, apply, and then reapply commits to the master branch.

Use Branch

Commits to the Chef repositories should never be made agains the master branch. Use a topic branch instead. A topic branch solves a single and unique problem and often maps closely to an issue being tracked in the repository. For example, a topic branch to add support for a new init system or a topic branch to resolve a bug that occurs in a specific version of CentOS. Ideally, a topic branch is named in a way that associates it closely with the issue it is attempting to resolve. This helps ensure that others may easily find it.

Use the following steps to create a topic branch:

  1. For a brand new clone of the Chef repository (that was created using the steps listed earlier), fetch the opscode remote:

    $ git fetch opscode
    
  2. Create an appropriately named tracking branch:

    $ git checkout --track -b CHEF-XX opscode/master
    

    Set up a topic branch to track opscode/master. This allows commits to be easily rebased prior to merging.

  3. Make your changes, and then commit them:

    $ git status
    
  4. And then run:

    $ git commit <filespec>
    
  5. Rebase the commits against opscode/master. After work in the topic branch is finished, rebase these commits against the upstream master. Do this manually with git fetch followed by a git rebase or use git pull --rebase.

    git will let you know if there are any problems. In the event of problems, fix them as directed, and then mark as fixed with a git add, and then continue the rebase process using git rebase --continue.

    For example:

    $ git fetch opscode
    

    followed by:

    $ git rebase opscode/master CHEF-XX
    

    Or:

    $ git pull --rebase
    
  6. Push the local topic branch to GitHub:

    $ git push origin CHEF-XX
    
  7. Send a GitHub pull request for the changes, and then update the Chef ticket with the appropriate information.

Delete Branch

After work has been merged by the branch maintainer, the topic branch is no longer necessary and should be removed.

  1. Synchronize the local master:

    $ git checkout master
    

    followed by:

    $ git pull --rebase
    
  2. Remove the local branch using -d to ensure that it has been merged by upstream. This option will not delete a branch that is not an ancestor of the current HEAD. From the git man page:

    -d
      Delete a branch. The branch must be fully merged in HEAD.
    -D
      Delete a branch irrespective of its merged status.
    
  3. Remove the local branch:

    $ git branch -d CHEF-XX
    

    Or remove the remote branch by using the full syntax to push and by omitting a source branch:

    $ git push origin :CHEF-XX