From 770e65103f6f632c6f22e5c1505800656d8f0793 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 24 Sep 2015 15:07:56 -0700 Subject: [PATCH 01/15] Rubocop fixes --- .rubocop.yml | 19 +++++++++++++++++++ Berksfile | 4 ++-- Gemfile | 2 +- attributes/default.rb | 3 +-- recipes/_common.rb | 2 +- recipes/default.rb | 13 +++---------- recipes/relay_restrictions.rb | 1 - .../helpers/serverspec/spec_helper.rb | 13 ++++++------- 8 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index abdea36..12b6147 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,31 @@ AllCops: Exclude: - vendor/**/* + - Guardfile AlignParameters: Enabled: false +ClassLength: + Enabled: false +CyclomaticComplexity: + Enabled: false +Documentation: + Enabled: false Encoding: Enabled: false +Style/FileName: + Enabled: false LineLength: Enabled: false MethodLength: Enabled: false +Metrics/AbcSize: + Enabled: false +PerceivedComplexity: + Enabled: false +SingleSpaceBeforeFirstArg: + Enabled: false +Style/ClassAndModuleChildren: + Enabled: false +Style/FileName: + Enabled: false diff --git a/Berksfile b/Berksfile index 3d60e57..71d3d18 100644 --- a/Berksfile +++ b/Berksfile @@ -5,6 +5,6 @@ metadata group :integration do cookbook 'apt' cookbook 'yum' - cookbook 'fake', :path => 'test/fixtures/cookbooks/fake' - cookbook 'wrapper', :path => 'test/fixtures/cookbooks/wrapper' + cookbook 'fake', path: 'test/fixtures/cookbooks/fake' + cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper' end diff --git a/Gemfile b/Gemfile index 46455bc..9fdfd97 100644 --- a/Gemfile +++ b/Gemfile @@ -36,4 +36,4 @@ group :development do gem 'rake' gem 'fauxhai' gem 'pry-nav' -end \ No newline at end of file +end diff --git a/attributes/default.rb b/attributes/default.rb index f14a4cf..d3b857b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -16,7 +16,7 @@ # limitations under the License. # Generic cookbook attributes -default['postfix']['mail_type'] = 'client' +default['postfix']['mail_type'] = 'client' default['postfix']['relayhost_role'] = 'relayhost' default['postfix']['multi_environment_relay'] = false default['postfix']['use_procmail'] = false @@ -145,4 +145,3 @@ end if node['postfix']['use_relay_restirictions_maps'] default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject" end - diff --git a/recipes/_common.rb b/recipes/_common.rb index b8fc106..d556f98 100644 --- a/recipes/_common.rb +++ b/recipes/_common.rb @@ -57,7 +57,7 @@ when 'omnios' # we don't guard this because if the user creation was successful (or happened out of band), then this won't get executed when the action is :nothing. execute '/opt/omni/sbin/postfix set-permissions' - template manifest_path do + template manifest_path do source 'manifest-postfix.xml.erb' owner 'root' group node['root_group'] diff --git a/recipes/default.rb b/recipes/default.rb index ba28cdc..ea10139 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -24,17 +24,11 @@ if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes' include_recipe 'postfix::sasl_auth' end -if node['postfix']['use_alias_maps'] - include_recipe 'postfix::aliases' -end +include_recipe 'postfix::aliases' if node['postfix']['use_alias_maps'] -if node['postfix']['use_transport_maps'] - include_recipe 'postfix::transports' -end +include_recipe 'postfix::transports' if node['postfix']['use_transport_maps'] -if node['postfix']['use_access_maps'] - include_recipe 'postfix::access' -end +include_recipe 'postfix::access' if node['postfix']['use_access_maps'] if node['postfix']['use_virtual_aliases'] include_recipe 'postfix::virtual_aliases' @@ -47,4 +41,3 @@ end if node['postfix']['use_relay_restrictions_maps'] include_recipe 'postfix::relay_restrictions' end - diff --git a/recipes/relay_restrictions.rb b/recipes/relay_restrictions.rb index a96d482..fe4e557 100644 --- a/recipes/relay_restrictions.rb +++ b/recipes/relay_restrictions.rb @@ -26,4 +26,3 @@ template node['postfix']['relay_restrictions_db'] do source 'relay_restrictions.erb' notifies :run, 'execute[update-postfix-relay-restrictions]' end - diff --git a/test/integration/helpers/serverspec/spec_helper.rb b/test/integration/helpers/serverspec/spec_helper.rb index fb6f099..2fbdaab 100644 --- a/test/integration/helpers/serverspec/spec_helper.rb +++ b/test/integration/helpers/serverspec/spec_helper.rb @@ -6,13 +6,13 @@ set :path, '/sbin:/usr/local/sbin:$PATH' def get_family fam = 'solaris2' return fam unless File.exist? '/etc/release' - File.open("/etc/release") do |file| - while line = file.gets - case line - when /^\s*(OmniOS)/ - fam = 'omnios' - end + File.open('/etc/release') do |file| + while line = file.gets + case line + when /^\s*(OmniOS)/ + fam = 'omnios' end + end end fam end @@ -24,4 +24,3 @@ def postfix_conf_path '/etc/postfix' end end - From 122762ee3cf7d256f82d3047699065a1fcbc0e38 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Thu, 24 Sep 2015 15:10:10 -0700 Subject: [PATCH 02/15] Exclude test --- .rubocop.yml | 1 + test/fixtures/cookbooks/wrapper/attributes/default.rb | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 12b6147..1ed1a76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,7 @@ AllCops: Exclude: - vendor/**/* - Guardfile + - test/**/* AlignParameters: Enabled: false diff --git a/test/fixtures/cookbooks/wrapper/attributes/default.rb b/test/fixtures/cookbooks/wrapper/attributes/default.rb index 6ea324e..d9cc166 100644 --- a/test/fixtures/cookbooks/wrapper/attributes/default.rb +++ b/test/fixtures/cookbooks/wrapper/attributes/default.rb @@ -1,6 +1,4 @@ - default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes' - default['postfix']['main']['relayhost'] = 'please' default['postfix']['sasl']['smtp_sasl_user_name'] = 'keep' default['postfix']['sasl']['smtp_sasl_passwd'] = 'us' From 798851e0c5981527f815ce1519e907e534477550 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 29 Sep 2015 10:00:02 -0700 Subject: [PATCH 03/15] Update chefignore --- chefignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chefignore b/chefignore index e403950..75d2251 100644 --- a/chefignore +++ b/chefignore @@ -54,6 +54,8 @@ features/* examples/* Guardfile Procfile +test/* +spec/* # SCM # ####### @@ -95,6 +97,3 @@ Vagrantfile # Travis # ########## .travis.yml -test/ -spec/ -examples/ From 3669256af0487f8d3bfa4030d80b8c47a49ab0a9 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 29 Sep 2015 10:09:12 -0700 Subject: [PATCH 04/15] Update foodcritic and rubocop releases --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9fdfd97..c0299c9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' group :lint do - gem 'foodcritic', '~> 4.0' - gem 'rubocop', '~> 0.33' + gem 'foodcritic', '~> 5.0' + gem 'rubocop', '~> 0.34' gem 'rake' end From 4dde02a66a6ea2828581264216aa4c0f9202478d Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 30 Sep 2015 12:39:09 -0700 Subject: [PATCH 05/15] Update requirements --- README.md | 14 ++++++++++---- metadata.rb | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cd44586..a80f301 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ On RHEL-family systems, sendmail will be replaced with postfix. Requirements ------------ -### Platforms +#### Platforms - Ubuntu 10.04+ - Debian 6.0+ - RHEL/CentOS/Scientific 5.7+, 6.2+ @@ -19,6 +19,12 @@ Requirements May work on other platforms with or without modification. +#### Chef +- Chef 11+ + +#### Cookbooks +- none + Attributes ---------- @@ -294,11 +300,11 @@ override_attributes( License & Authors ----------------- -- Author:: Joshua Timberman -```text -Copyright:: 2009-2015, Chef Software, Inc +**Author:** Cookbook Engineering Team () +**Copyright:** 2009-2015, Chef Software, Inc. +``` Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/metadata.rb b/metadata.rb index cc73aa1..b49caf1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -17,7 +17,7 @@ recipe 'postfix::virtual_aliases', 'Manages /etc/postfix/virtual' recipe 'postfix::client', 'Searches for the relayhost based on an attribute' recipe 'postfix::server', 'Sets the mail_type attribute to master' -%w(ubuntu debian redhat centos amazon oracle scientific smartos).each do |os| +%w(ubuntu debian redhat centos amazon oracle scientific smartos fedora).each do |os| supports os end From 4af61ed4d7e87604f04663820b6492f0b9818328 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 30 Sep 2015 12:39:28 -0700 Subject: [PATCH 06/15] Test on additional platforms --- .kitchen.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 1f4a1ac..8515980 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -7,12 +7,15 @@ provisioner: platforms: - name: centos-6.7 - name: centos-7.1 + - name: debian-7.8 + run_list: apt::default + - name: debian-8.1 + run_list: apt::default + - name: fedora-21 - name: ubuntu-12.04 - run_list: - - recipe[apt::default] + run_list: apt::default - name: ubuntu-14.04 - run_list: - - recipe[apt::default] + run_list: apt::default - name: omnios-r151014 driver: box: omnios-r151014 From c38f8de4d1837e6dc77a73561f0ed5ae86483e08 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 30 Sep 2015 12:39:46 -0700 Subject: [PATCH 07/15] Add rakefile for testers and maintainers --- Gemfile | 6 +++- MAINTAINERS.md | 19 +++++++++++ MAINTAINERS.toml | 46 +++++++++++++++++++++++++++ Rakefile | 61 +++++++++++++++++++++++++++++++++++ tasks/maintainers.rb | 76 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 MAINTAINERS.md create mode 100644 MAINTAINERS.toml create mode 100644 Rakefile create mode 100644 tasks/maintainers.rb diff --git a/Gemfile b/Gemfile index c0299c9..4d66542 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,13 @@ source 'https://rubygems.org' +group :rake do + gem 'rake' + gem 'tomlrb' +end + group :lint do gem 'foodcritic', '~> 5.0' gem 'rubocop', '~> 0.34' - gem 'rake' end group :unit do diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000..c6a51ae --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,19 @@ + + +# Maintainers +This file lists how this cookbook project is maintained. When making changes to the system, this +file tells you who needs to review your patch - you need a simple majority of maintainers +for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need +to not receive a veto from a Lieutenant or the Project Lead. + +Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) +for details on the process and how to become a maintainer or the project lead. + +# Project Maintainer +* [Tim Smith](https://github.com/tas50) + +# Maintainers +* [Jennifer Davis](https://github.com/sigje) +* [Sean OMeara](https://github.com/someara) +* [Tim Smith](https://github.com/tas50) +* [Thom May](https://github.com/thommay) diff --git a/MAINTAINERS.toml b/MAINTAINERS.toml new file mode 100644 index 0000000..47778d6 --- /dev/null +++ b/MAINTAINERS.toml @@ -0,0 +1,46 @@ +# +# This file is structured to be consumed by both humans and computers. +# It is a TOML document containing Markdown +# +[Preamble] + title = "Maintainers" + text = """ +This file lists how this cookbook project is maintained. When making changes to the system, this +file tells you who needs to review your patch - you need a simple majority of maintainers +for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need +to not receive a veto from a Lieutenant or the Project Lead. + +Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) +for details on the process and how to become a maintainer or the project lead. +""" + +[Org] + [Org.Components] + [Org.Components.Core] + title = "Project Maintainer" + + lieutenant = 'tas50' + + maintainers = [ + 'sigje', + 'someara', + 'tas50', + 'thommay' + ] + +[people] + [people.sigje] + name = "Jennifer Davis" + github = "sigje" + + [people.someara] + name = "Sean OMeara" + github = "someara" + + [people.tas50] + name = "Tim Smith" + github = "tas50" + + [people.thommay] + name = "Thom May" + github = "thommay" diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..3c52bbb --- /dev/null +++ b/Rakefile @@ -0,0 +1,61 @@ +require 'rspec/core/rake_task' +require 'rubocop/rake_task' +require 'foodcritic' +require 'kitchen' + +require_relative 'tasks/maintainers' + +# Style tests. Rubocop and Foodcritic +namespace :style do + desc 'Run Ruby style checks' + RuboCop::RakeTask.new(:ruby) + + desc 'Run Chef style checks' + FoodCritic::Rake::LintTask.new(:chef) do |t| + t.options = { + fail_tags: ['any'], + tags: ['~FC005'] + } + end +end + +desc 'Run all style checks' +task style: ['style:chef', 'style:ruby'] + +# Rspec and ChefSpec +desc 'Run ChefSpec examples' +RSpec::Core::RakeTask.new(:spec) + +# Integration tests. Kitchen.ci +namespace :integration do + desc 'Run Test Kitchen with Vagrant' + task :vagrant do + Kitchen.logger = Kitchen.default_file_logger + Kitchen::Config.new.instances.each do |instance| + instance.test(:always) + end + end + + desc 'Run Test Kitchen with cloud plugins' + task :cloud do + run_kitchen = true + if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false' + run_kitchen = false + end + + if run_kitchen + Kitchen.logger = Kitchen.default_file_logger + @loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml') + config = Kitchen::Config.new(loader: @loader) + config.instances.each do |instance| + instance.test(:always) + end + end + end +end + +desc 'Run all tests on Travis' +task travis: ['style', 'spec', 'integration:cloud'] + +# Default +task default: ['style', 'spec', 'integration:vagrant'] diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb new file mode 100644 index 0000000..7e99633 --- /dev/null +++ b/tasks/maintainers.rb @@ -0,0 +1,76 @@ +# +# Copyright:: Copyright (c) 2015 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'rake' + +SOURCE = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.toml') +TARGET = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.md') + +begin + require 'tomlrb' + task default: 'maintainers:generate' + + namespace :maintainers do + desc 'Generate MarkDown version of MAINTAINERS file' + task :generate do + @toml = Tomlrb.load_file SOURCE + out = "\n\n" + + out << preamble + out << project_lieutenant + out << all_maintainers + + File.open(TARGET, 'w') do |fn| + fn.write out + end + end + end + +rescue LoadError + STDERR.puts "\n*** TomlRb not available.\n\n" +end + +private + +def preamble + <<-EOL +# #{@toml['Preamble']['title']} +#{@toml['Preamble']['text']} +EOL +end + +def project_lieutenant + <<-EOL +# #{@toml['Org']['Components']['Core']['title']} +#{github_link(@toml['Org']['Components']['Core']['lieutenant'])} + +EOL +end + +def all_maintainers + text = "# Maintainers\n" + @toml['Org']['Components']['Core']['maintainers'].each do |m| + text << "#{github_link(m)}\n" + end + text +end + +def github_link(person) + name = @toml['people'][person]['name'] + github = @toml['people'][person]['github'] + "* [#{name}](https://github.com/#{github})" +end From 89d0777c3fd5b6168143ab1715cbecbebb754c01 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 6 Oct 2015 09:35:34 -0700 Subject: [PATCH 08/15] Update development and testing dependencies --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 4d66542..513908e 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,8 @@ group :lint do end group :unit do - gem 'berkshelf', '~> 3.2' - gem 'chefspec', '~> 4.3' + gem 'berkshelf', '~> 4.0' + gem 'chefspec', '~> 4.4' end group :kitchen_common do @@ -20,7 +20,7 @@ group :kitchen_common do end group :kitchen_vagrant do - gem 'kitchen-vagrant', '~> 0.18' + gem 'kitchen-vagrant', '~> 0.19' end group :kitchen_cloud do From c457d3dee0d753e5a05e6926c57f762af4ac44d2 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 7 Oct 2015 10:43:30 -0700 Subject: [PATCH 09/15] Run travis tests using Chef-DK installation --- .travis.yml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6769114..29a61ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,28 @@ +# Use Travis's cointainer based infrastructure sudo: false -cache: bundler -language: ruby -bundler_args: --without kitchen_common kitchen_vagrant kitchen_cloud -rvm: - - 2.0 - - 2.1 - - 2.2 +addons: + apt: + sources: + - chef-stable-precise + packages: + - chefdk + +# Don't `bundle install` +install: echo "skip bundle install" + +branches: + only: + - master + +# Ensure we make ChefDK's Ruby the default +before_script: + - eval "$(/opt/chefdk/bin/chef shell-init bash)" + # We have to install chef-sugar for ChefSpec + - /opt/chefdk/embedded/bin/chef gem install chef-sugar script: - - bundle exec foodcritic -f any . - - bundle exec rubocop - - bundle exec rspec --color --format progress + - /opt/chefdk/embedded/bin/chef --version + - /opt/chefdk/embedded/bin/rubocop --version + - /opt/chefdk/embedded/bin/rubocop + - /opt/chefdk/embedded/bin/foodcritic --version + - /opt/chefdk/embedded/bin/foodcritic . --exclude spec + - /opt/chefdk/embedded/bin/rspec spec From 5342671606c560a2b20e687d4f92138fae761eaf Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 7 Oct 2015 15:04:27 -0700 Subject: [PATCH 10/15] Use the pre-release builds of chefdk --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29a61ea..b8e7e02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false addons: apt: sources: - - chef-stable-precise + - chef-current-precise packages: - chefdk From 11037e9f9592975fcf32398b9cceded3c3e5b310 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 23 Oct 2015 16:32:14 -0700 Subject: [PATCH 11/15] Remove extra deps --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 513908e..ad821dc 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,5 @@ group :development do gem 'guard-foodcritic' gem 'guard-rspec' gem 'guard-rubocop' - gem 'rake' - gem 'fauxhai' gem 'pry-nav' end From e293ecc585dd526bdb4de650a5397b76e076fec2 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 23 Oct 2015 16:32:39 -0700 Subject: [PATCH 12/15] There's no need for yum --- Berksfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Berksfile b/Berksfile index 71d3d18..420871f 100644 --- a/Berksfile +++ b/Berksfile @@ -4,7 +4,6 @@ metadata group :integration do cookbook 'apt' - cookbook 'yum' cookbook 'fake', path: 'test/fixtures/cookbooks/fake' cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper' end From 93629df7392ae84810401fb8daa5a9e28feef595 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 23 Oct 2015 16:34:13 -0700 Subject: [PATCH 13/15] Use kitchen-docker for integration testing --- .kitchen.cloud.yml | 162 -------------------------------------------- .kitchen.docker.yml | 63 +++++++++++++++++ .travis.yml | 27 +++++--- 3 files changed, 81 insertions(+), 171 deletions(-) delete mode 100644 .kitchen.cloud.yml create mode 100644 .kitchen.docker.yml diff --git a/.kitchen.cloud.yml b/.kitchen.cloud.yml deleted file mode 100644 index bfcfbc6..0000000 --- a/.kitchen.cloud.yml +++ /dev/null @@ -1,162 +0,0 @@ ---- -driver_config: - digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %> - digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %> - google_client_email: <%= ENV['GOOGLE_CLIENT_EMAIL'] %> - google_key_location: <%= ENV['GOOGLE_KEY_LOCATION'] %> - google_project: <%= ENV['GOOGLE_PROJECT'] %> - joyent_username: <%= ENV['SDC_CLI_ACCOUNT'] %> - joyent_keyfile: <%= ENV['SDC_CLI_IDENTITY'] %> - joyent_keyname: <%= ENV['SDC_CLI_KEY_ID'] %> - joyent_url: <%= ENV['SDC_CLI_URL'] %> - aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> - aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> - aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %> - availability_zone: <%= ENV['AWS_AVAILABILITY_ZONE'] %> - -provisioner: - name: chef_zero - require_chef_omnibus: 11.12.8 - -platforms: -- name: centos-5.8 - driver_plugin: digitalocean - driver_config: - image_id: 1601 - flavor_id: 63 - region_id: 4 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - -- name: centos-6.5 - driver_plugin: digitalocean - driver_config: - image_id: 3448641 - flavor_id: 63 - region_id: 4 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - -- name: amazon-2013.09 - driver_plugin: ec2 - driver_config: - image_id: ami-3be4bc52 - username: ec2-user - ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %> - -- name: amazon-2014.03 - driver_plugin: ec2 - driver_config: - image_id: ami-6b726502 - username: ec2-user - ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %> - -# - name: fedora-19 -# driver_plugin: digitalocean -# driver_config: -# image_id: 3102879 -# flavor_id: 63 -# region_id: 4 -# ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> -# ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - -- name: debian-7.0 - driver_plugin: gce - driver_config: - image_name: debian-7-wheezy-v20131120 - zone: <%= ENV['GCE_ZONE'] %> - area: <%= ENV['GCE_AREA'] %> - network: <%= ENV['GCE_NETWORK'] %> - username: <%= ENV['GCE_USERNAME'] %> - public_key_path: <%= ENV['GCE_PUBLIC_KEY_PATH'] %> - ssh_key: <%= ENV['GCE_SSH_KEY_PATH'] %> - run_list: - - recipe[apt] - -- name: ubuntu-10.04 - driver_plugin: digitalocean - driver_config: - image_id: 14097 - flavor_id: 63 - region_id: 4 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - run_list: - - recipe[apt] - -- name: ubuntu-12.04 - driver_plugin: digitalocean - driver_config: - image_id: 3101045 - flavor_id: 63 - region_id: 4 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - run_list: - - recipe[apt] - -- name: ubuntu-14.04 - driver_plugin: digitalocean - driver_config: - image_id: 3240036 - flavor_id: 63 - region_id: 4 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> - run_list: - - recipe[apt] - -- name: smartos-13.4.0 - driver_plugin: joyent - driver_config: - joyent_image_id: ff86eb8a-a069-11e3-ae0e-4f3c8983a91c - joyent_flavor_id: g3-standard-4-smartos - username: root - ssh_key: <%= ENV['SDC_CLI_IDENTITY'] %> - busser: - ruby_bindir: '/opt/local/bin/' - provisioner: - name: chef_zero - sudo: false - chef_omnibus_url: https://raw.github.com/test-kitchen/kitchen-joyent/master/scripts/install-smartos.sh - -- name: omnios-151006 - driver_plugin: ec2 - driver_config: - image_id: ami-35eb835c - flavor_id: m3.medium - username: root - ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %> - provisioner: - name: chef_zero - run_list: - - recipe[ips-omniti] - -suites: -- name: default - run_list: - - recipe[postfix] - attributes: {} - -- name: aliases - run_list: - - recipe[postfix::aliases] - attributes: {} - -- name: client - run_list: - - recipe[postfix::client] - attributes: {} - -- name: server - run_list: - - recipe[postfix::server] - attributes: {} - -- name: sasl_auth - run_list: - - recipe[postfix::sasl_auth] - attributes: - postfix: - main : - smtp_sasl_auth_enable: "yes" diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml new file mode 100644 index 0000000..8472ac7 --- /dev/null +++ b/.kitchen.docker.yml @@ -0,0 +1,63 @@ +settings: + parallel: true + +driver: + name: docker + # privileged is required otherwise the container doesn't boot right + privileged: true + +platforms: +- name: centos-7.1 + driver: + image: centos:7 + platform: rhel + run_command: /usr/lib/systemd/systemd + provision_command: + - /bin/yum install -y initscripts net-tools wget +- name: ubuntu-12.04 + driver: + image: ubuntu-upstart:12.04 + platform: ubuntu + disable_upstart: false + run_command: /sbin/init + provision_command: + - /usr/bin/apt-get update + - /usr/bin/apt-get install apt-transport-https net-tools -y +- name: ubuntu-14.04 + driver: + image: ubuntu-upstart:14.04 + platform: ubuntu + disable_upstart: false + run_command: /sbin/init + provision_command: + - /usr/bin/apt-get update + - /usr/bin/apt-get install apt-transport-https net-tools -y + +suites: +- name: default + run_list: + - recipe[postfix] + +- name: aliases + run_list: + - recipe[postfix::aliases] + +- name: client + run_list: + - recipe[postfix::client] + +- name: server + run_list: + - recipe[postfix::server] + +- name: sasl_auth + run_list: + - recipe[postfix::sasl_auth] + attributes: + postfix: + main: + relayhost: "localhost" + smtp_sasl_auth_enable: "yes" + sasl: + smtp_sasl_user_name: "kitchenuser" + smtp_sasl_passwd: "not-a-real-thing" diff --git a/.travis.yml b/.travis.yml index b8e7e02..e7e9178 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ -# Use Travis's cointainer based infrastructure -sudo: false +rvm: 2.2 + +sudo: required + +# install the pre-release chef-dk. Use chef-stable-precise to install the stable release addons: apt: sources: @@ -7,22 +10,28 @@ addons: packages: - chefdk +services: docker + +env: + matrix: + - INSTANCE=default-ubuntu-1404 + - INSTANCE=default-ubuntu-1204 + - INSTANCE=default-centos-71 + # Don't `bundle install` install: echo "skip bundle install" -branches: - only: - - master - # Ensure we make ChefDK's Ruby the default before_script: + # https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142230889 + - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) - eval "$(/opt/chefdk/bin/chef shell-init bash)" - # We have to install chef-sugar for ChefSpec - - /opt/chefdk/embedded/bin/chef gem install chef-sugar + - /opt/chefdk/embedded/bin/chef gem install kitchen-docker script: - /opt/chefdk/embedded/bin/chef --version - /opt/chefdk/embedded/bin/rubocop --version - /opt/chefdk/embedded/bin/rubocop - /opt/chefdk/embedded/bin/foodcritic --version - /opt/chefdk/embedded/bin/foodcritic . --exclude spec - - /opt/chefdk/embedded/bin/rspec spec + - /opt/chefdk/embedded/bin/rspec + - KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE} From 6c612a50a434fba41e83ceaaa88cd4f49d9fe81a Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 23 Oct 2015 16:48:52 -0700 Subject: [PATCH 14/15] Fix test cookbook --- test/fixtures/cookbooks/wrapper/recipes/default.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/fixtures/cookbooks/wrapper/recipes/default.rb b/test/fixtures/cookbooks/wrapper/recipes/default.rb index 6bd393a..2efe077 100644 --- a/test/fixtures/cookbooks/wrapper/recipes/default.rb +++ b/test/fixtures/cookbooks/wrapper/recipes/default.rb @@ -1,2 +1 @@ - -include 'postfix' +include_recipe 'postfix' From 4ebe7a75ca850b755598ef1df209d709efbb97c0 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 30 Nov 2015 17:04:45 -0800 Subject: [PATCH 15/15] Remove RVM from Travis since we use Ruby in ChefDK --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e7e9178..5170fd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -rvm: 2.2 - sudo: required # install the pre-release chef-dk. Use chef-stable-precise to install the stable release