diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58b85a25..8eccb860 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,19 +23,18 @@ jobs: matrix: os: - almalinux-8 - # - amazonlinux-2 - - debian-10 + - almalinux-9 - debian-11 - - centos-7 - - centos-stream-8 - # - fedora-latest - - ubuntu-1804 + - debian-12 + - centos-stream-9 - ubuntu-2004 + - ubuntu-2204 + - ubuntu-2404 - rockylinux-8 - # - opensuse-leap-15 + - rockylinux-9 suite: - "varnish66" - - "varnish70" + - "varnish77" - "distro" - "full-stack" exclude: diff --git a/CHANGELOG.md b/CHANGELOG.md index f887bc54..96b9d7f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## Unreleased +Add new varnish releases + +Make default 7.7. + ## 5.0.20 - *2024-11-18* Standardise files with files in sous-chefs/repo-management @@ -228,7 +232,7 @@ Known Bugs: ## 2.2.2 -- # 86 - Removed monkey patching of service providers +- Removed monkey patching of service providers (#86) ## 2.2.1 @@ -267,13 +271,13 @@ Known Bugs: ### Bug -- **[COOK-3531](https://tickets.chef.io/browse/COOK-3531)** - Fix default instance name +- [COOK-3531] - Fix default instance name ## 0.9.8 ### Improvement -- **[COOK-3095](https://tickets.chef.io/browse/COOK-3095)** - Add MiniTest Chef Handler and Test Kitchen +- [COOK-3095] - Add MiniTest Chef Handler and Test Kitchen ## 0.9.6 diff --git a/README.md b/README.md index 2009a154..a2f2f3b5 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ These attributes used as defaults for both resources and the `varnish::configure - `node['varnish']['reload_cmd']` - location of the varnish reload script used by the systemd config file. This is not used for initd currently. - `node['varnish']['conf_source']` - template file source to use for the `default` varnish init config. - `node['varnish']['conf_cookbook']` - template cookbook source to use for the `default` varnish init config. -- `node['varnish']['major_version']` - the major version of varnish to install. Can be any valid major release. Defaults to 7.0. +- `node['varnish']['major_version']` - the major version of varnish to install. Can be any valid major release. Defaults to 7.7. ## Recipes diff --git a/attributes/default.rb b/attributes/default.rb index 2302e05b..87a1adde 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -3,7 +3,7 @@ ## default['varnish']['conf_cookbook'] = 'varnish' -default['varnish']['major_version'] = 4.1 +default['varnish']['major_version'] = 7.7 default['varnish']['configure']['repo']['action'] = :configure diff --git a/documentation/varnish_config.md b/documentation/varnish_config.md index fe9799e6..06788d27 100644 --- a/documentation/varnish_config.md +++ b/documentation/varnish_config.md @@ -1,7 +1,7 @@ -[Back to resource list](../README.md#resources) - # varnish_config +[Back to resource list](../README.md#resources) + Configures the Varnish service through the defaults or systemd init file. If you do not include this, the config files that come with your distro package will be used instead. ## Actions diff --git a/documentation/varnish_log.md b/documentation/varnish_log.md index fee3adf7..e37ec3f7 100644 --- a/documentation/varnish_log.md +++ b/documentation/varnish_log.md @@ -1,7 +1,7 @@ -[Back to resource list](../README.md#resources) - # varnish_log +[Back to resource list](../README.md#resources) + Configures varnishlog or varnishncsa service. You can define both logfiles by calling `varnish_log` more than once. You can install logrotate config files if you wish as well. ## Actions @@ -17,7 +17,7 @@ Configures varnishlog or varnishncsa service. You can define both logfiles by ca | `file_name` | String | `'/var/log/varnish/varnishlog.log'` | | `pid` | String | `'/var/run/varnishlog.pid'` | | `log_format` | `'varnishlog'` or `'varnishncsa'` | `'varnishlog'` | -| `ncsa_format_string` | String | `'%h \| %l \| %u \| %t \| \"%r\" \| %s \| %b \| \"%{Referer}i\" | \"%{User-agent}i\"'` | +| `ncsa_format_string` | String | `'%h \| %l \| %u \| %t \| \"%r\" \| %s \| %b \| \"%{Referer}i\" \| \"%{User-agent}i\"'` | | `instance_name` | String | name property | | `logrotate` | `true`, `false` | `true` vanishlog, `false` for varnishncsa | | `major_version` | Minor supported release | Currently installed major version (If varnish isn't installed yet then you will have to set this explicitly) | diff --git a/documentation/varnish_repo.md b/documentation/varnish_repo.md index c215b6b8..c5114e0a 100644 --- a/documentation/varnish_repo.md +++ b/documentation/varnish_repo.md @@ -1,7 +1,7 @@ -[Back to resource list](../README.md#resources) - # varnish_repo +[Back to resource list](../README.md#resources) + Configure's the varnish vendor repo. ## Actions diff --git a/documentation/vcl_file.md b/documentation/vcl_file.md index 75708279..d1d6a0ec 100644 --- a/documentation/vcl_file.md +++ b/documentation/vcl_file.md @@ -1,7 +1,7 @@ -[Back to resource list](../README.md#resources) - # vcl_file +[Back to resource list](../README.md#resources) + Create vcl file at `/etc/varnish/default.vcl` using the file at `files/default/default.vcl`: ## Actions diff --git a/documentation/vcl_template.md b/documentation/vcl_template.md index e77fc514..35ccd6b6 100644 --- a/documentation/vcl_template.md +++ b/documentation/vcl_template.md @@ -1,7 +1,7 @@ -[Back to resource list](../README.md#resources) - # vcl_template +[Back to resource list](../README.md#resources) + Create vcl file at `/etc/varnish/backends.vcl` using the template at `templates/default/backends.vcl.erb` and pass it some variables: ## Actions diff --git a/kitchen.yml b/kitchen.yml index 3b545a79..211a6b12 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -43,17 +43,17 @@ suites: version: 6.6 excludes: - debian-11 - - name: varnish70 + - name: varnish77 run_list: - recipe[install_varnish::vendor_install] attributes: varnish: - major_version: 7.0 + major_version: 7.7 verifier: inspec_tests: - path: test/integration/varnish inputs: - version: 7.0 + version: 7.7 - name: distro run_list: - recipe[install_varnish::distro_install] diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 2d59f2db..507f840e 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -8,6 +8,13 @@ module Helpers # rubocop:disable Style/ModuleFunction extend self # Stubbing with module_function doesn't seem to work + def supported_major_versions + [ + 3.0, 4.0, 4.1, 5, 5.0, 5.1, 5.2, 6.0, 6.1, 6.2, 6.3, + 6.4, 6.5, 6.6, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7 + ] + end + def installed_major_version cmd_str = 'varnishd -V 2>&1' cmd = shell_out!(cmd_str) diff --git a/resources/config.rb b/resources/config.rb index 22070526..ba84a648 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -10,7 +10,7 @@ property :max_locked_memory, Integer, default: 82_000 property :instance_name, String, default: VarnishCookbook::Helpers.hostname property :major_version, Float, - equal_to: [3.0, 4.0, 4.1, 5, 5.0, 5.1, 5.2, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 7.0], + equal_to: VarnishCookbook::Helpers.supported_major_versions, default: lazy { VarnishCookbook::Helpers.installed_major_version } # Daemon options diff --git a/resources/log.rb b/resources/log.rb index 7fdb2ab9..e21f50b4 100644 --- a/resources/log.rb +++ b/resources/log.rb @@ -6,7 +6,7 @@ property :instance_name, String, default: VarnishCookbook::Helpers.hostname property :major_version, Float, - equal_to: [3.0, 4.0, 4.1, 5, 5.0, 5.1, 5.2, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 7.0], + equal_to: VarnishCookbook::Helpers.supported_major_versions, default: lazy { VarnishCookbook::Helpers.installed_major_version } property :ncsa_format_string, [String, nil], default: lazy { diff --git a/resources/varnish_repo_redhat.rb b/resources/varnish_repo_redhat.rb index 61270fc2..833349e9 100644 --- a/resources/varnish_repo_redhat.rb +++ b/resources/varnish_repo_redhat.rb @@ -7,7 +7,7 @@ action :configure do dnf_module 'varnish' do action :disable - only_if { node['platform_version'].to_i >= 8 } + only_if { node['platform_version'].to_i == 8 } end # packagecloud repos omit dot from major version diff --git a/test/integration/varnish/controls/default_spec.rb b/test/integration/varnish/controls/default_spec.rb index adf7010f..af9a72c9 100644 --- a/test/integration/varnish/controls/default_spec.rb +++ b/test/integration/varnish/controls/default_spec.rb @@ -1,9 +1,6 @@ version = input('version', value: 0) ncsa_format_string = input('ncsa_format_string') full_stack = input('full_stack') -os_family = os.family -os_release = os.release -os_name = os.name control 'default' do describe command 'varnishd -V' do @@ -89,17 +86,7 @@ describe command "varnishadm #{varnishadm_opts} backend.list" do its('exit_status') { should eq 0 } - if version.to_i >= 6 - its('stdout') { should match(%r{default\s+healthy\s+0/0\s+[Hh]ealthy}) } - elsif version == 0 && os_family == 'redhat' && os_release.to_i == 7 - its('stdout') { should match(/default\(127.0.0.1,,8080\)\s+2\s+probe\s+Healthy/) } - elsif version == 0 && os_name == 'debian' && os_release.to_i >= 11 - its('stdout') { should match(%r{default\s+healthy\s+0/0\s+[Hh]ealthy}) } - elsif version == 0 && os_name == 'ubuntu' && os_release.to_f >= 20.04 - its('stdout') { should match(%r{default\s+healthy\s+0/0\s+[Hh]ealthy}) } - else - its('stdout') { should match(/default\s+probe\s+[Hh]ealthy/) } - end + its('stdout') { should match(/default.+[Hh]ealthy/) } end describe command "varnishadm #{varnishadm_opts} param.show thread_pool_max" do