There is a common set of acceptance criteria for all Chef Provisioning resources. This is the minimum set of acceptance criteria - individual projects may expand these.
In order to be complete, resources in this library must have the following properties:
- The resource must have fully functional
:create
and:destroy
actions. - If the object specified by the resource already exists, and the
:create
action is called, then the:create
action must update all available attributes for the specified object. - If the attributes cannot be updated then the
:create
action must function as a:create_if_missing
. - Each resource must have a full suite of tests.
- Tests must validate
:create
and:destroy
actions. - Tests must validate that all update-able attribute can be updated on a subsequent
:create
action. - Tests may assume that if the SDK does not return an error, then the call was successful.
- The tests must run in a CI system.
- Reference documentation must exist on docs.chef.io for the resource. The documentation must qualify any caveats / specialties about the resource and defines all available attributes & actions. The documentation must include a real world code example.
- An example of a caveat is that AWS Internet Gateways cannot be updated once created, they must be destroyed and recreated.
- All examples must be functional. A user should be able to copy/paste the code example into a program and see it work.
- If an attribute is not specified on a resource, and update should not modify that attribute on the object. For example, leaving the
routes
attribute off aaws_route_table
resource should not clear all existing routes. It should leave them alone. - To clear a attribute you should specify an empty array/hash for attributes that accept multiple values.
- Starting in Chef 12.5 attributes can have the
nil
value set on them. This will signify that the attribute should be cleared or reset to the default. EG, settingdescription nil
will clear the current description.
- Provisioning recipes need to be paramaterized. This is often done by specifying modifying attributes via environments or roles. It can also be searched from a 3rd party service, such as a CMDB. All resources should adhere to this principal.
- This effectively means a user who models an object as a hash or struct should be able to pass that to the resource and have the resource converge it. If it is a hash, the resource should handle strings vs symbols vs Mashes correctly.
- It could also mean that we add a criteria saying a resource should be able to explode the elements of a hash into the attributes of the resource before converging it. IE, an
options
hash would accept a JSON object and the resource would use this to populate thedescription
,count
andstyle
attributes on the resource.
This release process applies to all chef-provisioning(-*) projects, but each project may have additional requirements.
- Perform a Github diff between master and the last released version. Determine whether included PRs justify a patch, minor or major version release.
- Check out the master branch of the project being prepared for release.
- Branch into a release-branch of the form
150_release_prep
. - Modify the
version.rb
file to specify the version for releasing. - Update the changelog to include what is being released.
- For these projects we use the github changelog generator. Install that gem if you don't have it yet.
- Run
github_changelog_generator <github project> -t <token> --future-release <version to release> --enhancement-labels "enhancement,Enhancement,New Feature" --bug-labels "bug,Bug,Improvement" --exclude-labels "Exclude From Changelog"
- For example, if we are releasing version
1.5.0
ofchef_provisioning
the command would look likegithub_changelog_generator chef/chef_provisioning -t 123 --future-release 1.5.0 --enhancement-labels "enhancement,Enhancement,New Feature" --bug-labels "bug,Bug,Improvement" --exclude-labels "Exclude From Changelog"
- This will poll Github for issues and PRs to format into the changelog, then it will automatically update the changelog.
- Parse the changelog and look for any issues/PRs that do not need to be included. These should be tagged with the
Exclude From Changelog
tag in github. Examples of PRs to exclude are ones that only modify the README in a trivial way. git commit
theversion.rb
andCHANGELOG.md
changes to the branch and setup a PR for them. Allow the PR to run any automated tests and review the CHANGELOG for accuracy. Tag this PR with theExclude From Changelog
tag so it doesn't appear in the changelog for the _next_release.- Merge the PR to master after review.
- Switch your local copy to the master branch and
git pull
to pull in the release preperation changes. - Run
rake release
on the master branch.