Skip to content

Chef Upgrade #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 49 additions & 39 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,55 @@
driver:
name: vagrant
network:
- ["forwarded_port", {guest: 110, host: 8110, auto_correct: true}]
- ["forwarded_port", {guest: 995, host: 8995, auto_correct: true}]
- ["forwarded_port", {guest: 143, host: 8143, auto_correct: true}]
- ["forwarded_port", {guest: 993, host: 8993, auto_correct: true}]
- - forwarded_port
- guest: 110
host: 8110
auto_correct: true
- - forwarded_port
- guest: 995
host: 8995
auto_correct: true
- - forwarded_port
- guest: 143
host: 8143
auto_correct: true
- - forwarded_port
- guest: 993
host: 8993
auto_correct: true

provisioner:
name: chef_zero
product_name: chef
product_version: 18
always_update_cookbooks: true
data_bags_path: ./test/data_bags
# client_rb:
# treat_deprecation_warnings_as_errors: true # WiP on some depends
deprecations_as_errors: true
client_rb:
chef_license: accept
treat_deprecation_warnings_as_errors: true # WiP on some depends

platforms:
- name: centos-6.7
- name: centos-7.2
- name: centos-7.4
- name: centos-7.5
- name: fedora-26
- name: fedora-28
- name: oracle-6.9
- name: centos-7.9
- name: centos-stream-8
- name: centos-stream-9
- name: fedora-36
- name: fedora-37
- name: oracle-7.4
- name: debian-7.11
- name: oracle-7.9
# - name: oracle-8.7 # fail: no image
- name: oracle-9.1
- name: debian-10.13
run_list: recipe[apt]
- name: debian-8.9
- name: debian-11.6
run_list: recipe[apt]
- name: debian-8.10
run_list: recipe[apt]
- name: debian-9.2
run_list: recipe[apt]
- name: debian-9.3
run_list: recipe[apt]
- name: debian-9.4
run_list: recipe[apt]
- name: ubuntu-14.04
- name: ubuntu-18.04
run_list: recipe[apt]
- name: ubuntu-16.04
- name: ubuntu-20.04
run_list: recipe[apt]
- name: ubuntu-18.04
- name: ubuntu-22.04
run_list: recipe[apt]
- name: opensuse-leap-42
- name: opensuse-leap-15

suites:
- name: default
Expand All @@ -52,21 +62,21 @@ suites:
excludes:
# does not use (deprecated) slapd.conf anymore,
# and openldap cookbook is not up-to-date with this change yet
- fedora-26
- fedora-28
- fedora-36
- fedora-37
- ubuntu-22.04
# FIXME: broken mirror
- centos-stream-8
- oracle-9.1
# FIXME: ldap_spec fails
- centos-7.9
- centos-stream-9
- oracle-7.4
- oracle-7.9
- ubuntu-18.04
- name: attributes
run_list:
- recipe[dovecot_test::attributes]
- name: create_pwfile
run_list:
- recipe[dovecot_test::create_pwfile]
excludes:
# old versions of Dovecot does not support default_field_values
- centos-6.7
- oracle-6.9
# by default does not have 'snakeoil' self-signed cert and key
- debian-8.9
- debian-8.10
- debian-9.2
- debian-9.3
- debian-9.4
12 changes: 8 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- .kitchen
- vendor/**/*
TargetChefVersion: 18.0

Metrics/ModuleLength:
Max: 121

Style/CommentedKeyword:
Enabled: False

Metrics/LineLength:
Layout/LineLength:
Max: 100

Metrics/BlockLength:
ExcludedMethods: ['describe', 'context']
IgnoredMethods: ['describe', 'context']
Max: 50

Layout/IndentHeredoc:
Layout/HeredocIndentation:
Enabled: False

Naming/HeredocDelimiterNaming:
Expand All @@ -24,7 +28,7 @@ Naming/HeredocDelimiterNaming:
Style/MultilineIfModifier:
Enabled: False

Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
Enabled: False

Layout/ClosingHeredocIndentation:
Expand Down
16 changes: 16 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
# using RuboCop version 1.25.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: **/resources/*.rb
Chef/Deprecations/ResourceWithoutUnifiedTrue:
Exclude:
- 'test/integration/create_pwfile/serverspec/resources/imap_server_resource.rb'
- 'test/integration/ldap/serverspec/resources/imap_server_resource.rb'
86 changes: 44 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,52 @@ env:
matrix:
- TESTS="style unit"
# Split up the test-kitchen run to avoid exceeding 50 minutes:
- TESTS="integration[default-centos-6,verify]"
- TESTS="integration[default-centos-7,verify]"
- TESTS="integration[default-debian-7,verify]"
- TESTS="integration[default-debian-8,verify]"
- TESTS="integration[default-debian-9,verify]"
- TESTS="integration[default-fedora-26,verify]"
- TESTS="integration[default-fedora-28,verify]"
- TESTS="integration[default-oracle-6,verify]"
- TESTS="integration[default-oracle-7,verify]"
- TESTS="integration[default-ubuntu-1404,verify]"
- TESTS="integration[default-ubuntu-1604,verify]"
- TESTS="integration[default-centos-79,verify]"
- TESTS="integration[default-centos-stream-8,verify]"
- TESTS="integration[default-centos-stream-9,verify]"
- TESTS="integration[default-fedora-36,verify]"
- TESTS="integration[default-fedora-37,verify]"
- TESTS="integration[default-oracle-74,verify]"
- TESTS="integration[default-oracle-79,verify]"
- TESTS="integration[default-oracle-91,verify]"
- TESTS="integration[default-debian-1013,verify]"
- TESTS="integration[default-debian-116,verify]"
- TESTS="integration[default-ubuntu-1804,verify]"
- TESTS="integration[default-opensuse-leap-42,verify]"
- TESTS="integration[ldap-centos-6,verify]"
- TESTS="integration[ldap-centos-7,verify]"
- TESTS="integration[ldap-debian-7,verify]"
- TESTS="integration[ldap-debian-8,verify]"
- TESTS="integration[ldap-debian-9,verify]"
- TESTS="integration[ldap-oracle-6,verify]"
- TESTS="integration[ldap-oracle-7,verify]"
- TESTS="integration[ldap-ubuntu-1404,verify]"
- TESTS="integration[ldap-ubuntu-1604,verify]"
- TESTS="integration[ldap-ubuntu-1804,verify]"
- TESTS="integration[ldap-opensuse-leap-42,verify]"
- TESTS="integration[attributes-centos-6,verify]"
- TESTS="integration[attributes-centos-7,verify]"
- TESTS="integration[attributes-debian-7,verify]"
- TESTS="integration[attributes-debian-8,verify]"
- TESTS="integration[attributes-debian-9,verify]"
- TESTS="integration[attributes-fedora-26,verify]"
- TESTS="integration[attributes-fedora-28,verify]"
- TESTS="integration[attributes-oracle-6,verify]"
- TESTS="integration[attributes-oracle-7,verify]"
- TESTS="integration[attributes-ubuntu-1404,verify]"
- TESTS="integration[attributes-ubuntu-1604,verify]"
- TESTS="integration[default-ubuntu-2004,verify]"
- TESTS="integration[default-ubuntu-2204,verify]"
- TESTS="integration[default-opensuse-leap-15,verify]"
- TESTS="integration[ldap-debian-1013,verify]"
- TESTS="integration[ldap-debian-116,verify]"
- TESTS="integration[ldap-ubuntu-2004,verify]"
- TESTS="integration[ldap-opensuse-leap-15,verify]"
- TESTS="integration[attributes-centos-79,verify]"
- TESTS="integration[attributes-centos-stream-8,verify]"
- TESTS="integration[attributes-centos-stream-9,verify]"
- TESTS="integration[attributes-fedora-36,verify]"
- TESTS="integration[attributes-fedora-37,verify]"
- TESTS="integration[attributes-oracle-74,verify]"
- TESTS="integration[attributes-oracle-79,verify]"
- TESTS="integration[attributes-oracle-91,verify]"
- TESTS="integration[attributes-debian-1013,verify]"
- TESTS="integration[attributes-debian-116,verify]"
- TESTS="integration[attributes-ubuntu-1804,verify]"
- TESTS="integration[attributes-opensuse-leap-42,verify]"
- TESTS="integration[create-pwfile-centos-7,verify]"
- TESTS="integration[create-pwfile-debian-7,verify]"
- TESTS="integration[create-pwfile-oracle-7,verify]"
- TESTS="integration[create-pwfile-ubuntu-1404,verify]"
- TESTS="integration[create-pwfile-ubuntu-1604,verify]"
- TESTS="integration[attributes-ubuntu-2004,verify]"
- TESTS="integration[attributes-ubuntu-2204,verify]"
- TESTS="integration[attributes-opensuse-leap-15,verify]"
- TESTS="integration[create-pwfile-centos-79,verify]"
- TESTS="integration[create-pwfile-centos-stream-8,verify]"
- TESTS="integration[create-pwfile-centos-stream-9,verify]"
- TESTS="integration[create-pwfile-fedora-36,verify]"
- TESTS="integration[create-pwfile-fedora-37,verify]"
- TESTS="integration[create-pwfile-oracle-74,verify]"
- TESTS="integration[create-pwfile-oracle-79,verify]"
- TESTS="integration[create-pwfile-oracle-91,verify]"
- TESTS="integration[create-pwfile-debian-1013,verify]"
- TESTS="integration[create-pwfile-debian-116,verify]"
- TESTS="integration[create-pwfile-ubuntu-1804,verify]"
- TESTS="integration[create-pwfile-opensuse-leap-42,verify]"
- TESTS="integration[create-pwfile-ubuntu-2004,verify]"
- TESTS="integration[create-pwfile-ubuntu-2204,verify]"
- TESTS="integration[create-pwfile-opensuse-leap-15,verify]"

before_install:
- chef --version &> /dev/null || curl -L https://www.getchef.com/chef/install.sh | sudo bash -s -- -P chefdk -v 3.1.0
Expand All @@ -68,6 +70,6 @@ before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- chef --version
- cookstyle --version
- foodcritic --version
- rubocop --version

script: travis_retry chef exec bundle exec rake $TESTS
2 changes: 1 addition & 1 deletion Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ my_cookbook = 'dovecot'
# return void
def local_cookbook(name, version = '>= 0.0.0', options = {})
cookbook(name, version, {
path: "../../cookbooks/#{name}"
path: "../../cookbooks/#{name}",
}.merge(options))
end

Expand Down
51 changes: 10 additions & 41 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,22 @@

source 'https://rubygems.org'

chef_version = ENV.key?('CHEF_VERSION') ? ENV['CHEF_VERSION'] : nil

group :doc do
gem 'yard'
end

group :test do
gem 'berkshelf', '~> 7.0'
gem 'rake'
end

group :style do
gem 'foodcritic', '~> 14.0.0'
gem 'rubocop', '~> 0.58.0'
end
group :development do
# gem 'berkshelf'
# gem 'chefspec'
# gem 'cookstyle'
# gem 'rake'

group :unit do
gem 'chef', chef_version unless chef_version.nil?
gem 'chefspec', '= 7.2.1'
gem 'should_not', '~> 1.1.0'
gem 'simplecov', '~> 0.16.1'
end

group :integration do
gem 'test-kitchen'
end

group :integration_docker do
gem 'kitchen-docker'
end

group :integration_vagrant do
gem 'kitchen-vagrant'
gem 'vagrant-wrapper'
end

group :integration_cloud do
gem 'kitchen-digitalocean', '~> 0.9.5'
gem 'kitchen-ec2', '~> 1.2'
end
# gem 'chef-cli'
# gem 'rspec'
gem 'should_not'

group :guard do
gem 'guard'
gem 'guard-foodcritic'
gem 'guard-kitchen'
gem 'guard-rspec'
gem 'guard-rubocop'
# gem 'simplecov', require: false
# gem 'net-ftp'
end

group :travis do
Expand Down
30 changes: 3 additions & 27 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,9 @@

group :style,
halt_on_fail: true do
guard :foodcritic,
cli: '--exclude test/unit',
cookbook_paths: '.',
all_on_start: false do
watch(%r{attributes/.+\.rb$})
watch(%r{definitions/.+\.rb$})
watch(%r{libraries/.+\.rb$})
watch(%r{providers/.+\.rb$})
watch(%r{recipes/.+\.rb$})
watch(%r{resources/.+\.rb$})
watch(%r{templates/.+\.erb$})
watch('metadata.rb')
end

guard :rubocop,
all_on_start: false do
guard :rubocop, cli: '-r cookstyle' do
watch(/.+\.rb$/)
watch('Gemfile')
watch('Rakefile')
watch('Capfile')
watch('Guardfile')
watch('Podfile')
watch('Thorfile')
watch('Vagrantfile')
watch('Berksfile')
watch('Cheffile')
watch('Vagabondfile')
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
end # group style

Expand Down Expand Up @@ -82,4 +58,4 @@ end # group unit
# end
# end # group integration

scope groups: %i[style unit]
scope groups: %i(style unit)
Loading