Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Adds a kitchen flag that gives options for different kitchen configs
Browse files Browse the repository at this point in the history
To provide support out-of-the-box for kitchen-dokken there is a flag now
to specify which base kitchen configuration to use.

Signed-off-by: Franklin Webber <franklin@chef.io>
  • Loading branch information
Franklin Webber committed Mar 8, 2018
1 parent 0de8e36 commit 9df4e0f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/chef-dk/command/generator_commands/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Cookbook < Base
boolean: true,
default: nil

option :kitchen,
long: "--kitchen CONFIGURATION",
description: "Generate cookbooks with a specific kitchen configuration (dokken|vagrant) - defaults to vagrant",
default: "vagrant"

option :policy,
short: "-P",
long: "--policy",
Expand Down Expand Up @@ -131,6 +136,11 @@ def setup_context

Generator.add_attr_to_context(:use_berkshelf, berks_mode?)
Generator.add_attr_to_context(:pipeline, pipeline)
Generator.add_attr_to_context(:kitchen, kitchen)
end

def kitchen
config[:kitchen]
end

def pipeline
Expand Down
5 changes: 4 additions & 1 deletion lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@

# Test Kitchen
template "#{cookbook_dir}/.kitchen.yml" do
if context.use_berkshelf
if context.kitchen == 'dokken'
# kitchen-dokken configuration works with berkshelf and policyfiles
source 'kitchen_dokken.yml.erb'
elsif context.use_berkshelf
source 'kitchen.yml.erb'
else
source 'kitchen_policyfile.yml.erb'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
driver:
name: dokken

provisioner:
name: dokken

transport:
name: dokken

verifier:
name: inspec

platforms:
# @see https://github.com/someara/dokken-images
# @see https://hub.docker.com/r/dokken/
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
- name: centos-7
driver:
image: dokken/centos-7

suites:
- name: default
run_list:
- recipe[<%= cookbook_name %>::default]
verifier:
inspec_tests:
- test/integration/default
attributes:

0 comments on commit 9df4e0f

Please sign in to comment.