From 855df6b5ef166838e2292b27b641c214a833744d Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Tue, 30 Jan 2024 10:48:12 +0000 Subject: [PATCH] Update source install versions Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 53 ++++++++----------- .rubocop.yml | 0 CHANGELOG.md | 3 ++ Dangerfile | 2 +- Guardfile | 10 ++-- kitchen.yml | 21 ++++---- resources/config_global.rb | 10 ++-- resources/install.rb | 4 +- test/cookbooks/test/recipes/config_array.rb | 3 +- test/cookbooks/test/recipes/source.rb | 4 +- .../recipes/{source-24.rb => source_24.rb} | 8 +-- .../recipes/{source-18.rb => source_26.rb} | 8 +-- .../recipes/{source-20.rb => source_28.rb} | 8 +-- .../recipes/{source-22.rb => source_29.rb} | 8 +-- test/cookbooks/test/recipes/source_openssl.rb | 2 +- test/integration/config_4/example_spec.rb | 2 +- test/integration/source-2.4/source_spec.rb | 2 +- .../{source-1.8 => source_2.6}/source_spec.rb | 0 .../{source-2.0 => source_2.8}/source_spec.rb | 0 test/integration/source_2.9/source_spec.rb | 13 +++++ test/integration/source_lua/lua_spec.rb | 2 +- .../source_openssl/openssl_spec.rb | 2 +- 22 files changed, 86 insertions(+), 79 deletions(-) create mode 100644 .rubocop.yml rename test/cookbooks/test/recipes/{source-24.rb => source_24.rb} (58%) rename test/cookbooks/test/recipes/{source-18.rb => source_26.rb} (55%) rename test/cookbooks/test/recipes/{source-20.rb => source_28.rb} (56%) rename test/cookbooks/test/recipes/{source-22.rb => source_29.rb} (56%) rename test/integration/{source-1.8 => source_2.6}/source_spec.rb (100%) rename test/integration/{source-2.0 => source_2.8}/source_spec.rb (100%) create mode 100644 test/integration/source_2.9/source_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0a80bbc..73edb2c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,36 +32,26 @@ jobs: - "centos-stream-8" - "fedora-latest" suite: + - config-1-userlist + - config-1 + - config-2 + - config-3 + - config-4 + - config-acl + - config-array + - config-backend-search + - config-custom-template + - config-fastcgi + - config-resolver + - config-ssl-redirect - "package" - - "source-18" - - "source-20" - - "source-22" - - "source-default" + - "source-24" + - "source-26" + - "source-28" + - "source-29" + - "source-lua" - "source-openssl" - exclude: - # Excluded due to https://github.com/sous-chefs/haproxy/issues/475 - - os: "fedora-latest" - suite: "source-18" - - os: "fedora-latest" - suite: "source-20" - - os: "fedora-latest" - suite: "source-22" - - os: "fedora-latest" - suite: "source-default" - - os: "fedora-latest" - suite: "source-openssl" - - os: "ubuntu-2204" - suite: "source-18" - - os: "ubuntu-2204" - suite: "source-20" - - os: "ubuntu-2204" - suite: "source-22" - - os: "ubuntu-2204" - suite: "source-24" - - os: "ubuntu-2204" - suite: "source-default" - - os: "ubuntu-2204" - suite: "source-openssl" + - "source-default" fail-fast: false steps: @@ -87,9 +77,10 @@ jobs: - "amazonlinux-2" suite: - "package" - - "source-18" - - "source-20" - - "source-22" + - "source-24" + - "source-26" + - "source-28" + - "source-29" - "source-default" fail-fast: false diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/CHANGELOG.md b/CHANGELOG.md index d04d28fa..eed7c6dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This file is used to list changes made in each version of the haproxy cookbook. ## Unreleased +- Update default HAProxy source install verision to 2.8.5 +- Update source install tests to include versions 2.4, 2.6, 2.8, 2.9 + ## 12.2.23 - *2023-10-26* ## 12.2.22 - *2023-09-28* diff --git a/Dangerfile b/Dangerfile index bc08b7ae..a31ad760 100644 --- a/Dangerfile +++ b/Dangerfile @@ -37,7 +37,7 @@ if !git.modified_files.include?('CHANGELOG.md') && code_changes? end # Require Major Minor Patch version labels -unless github.pr_labels.grep /minor|major|patch/i +unless github.pr_labels.grep(/minor|major|patch/i) warn 'Please add a release label to this pull request' end diff --git a/Guardfile b/Guardfile index 06cd4bf8..2679a2fa 100644 --- a/Guardfile +++ b/Guardfile @@ -1,25 +1,25 @@ -require 'cookstyle' +require "cookstyle" -guard :rubocop, keep_failed: false, cli: '-r finstyle' do +guard :rubocop, keep_failed: false, cli: "-r finstyle" do watch(/.+\.rb$/) { |m| m[0] } watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } end -guard 'foodcritic', cookbook_paths: '.', cli: '-C -t ~FC001' do +guard "foodcritic", cookbook_paths: ".", cli: "-C -t ~FC001" do watch(%r{attributes/.+\.rb$}) watch(%r{providers/.+\.rb$}) watch(%r{recipes/.+\.rb$}) watch(%r{resources/.+\.rb$}) end -spec_path = 'test/unit' +spec_path = "test/unit" rspec_guard_config = { cmd: "bundle exec rspec --color --format progress --default-path=#{spec_path}", all_on_start: true, spec_paths: [spec_path], } -guard 'rspec', rspec_guard_config do +guard "rspec", rspec_guard_config do watch(%r{^#{spec_path}/.+_spec\.rb$}) watch("#{spec_path}/spec_helper.rb") { spec_path } watch(%r{^(libraries|providers|recipes|resources)/(.+)\.rb$}) do |m| diff --git a/kitchen.yml b/kitchen.yml index 82e3db5a..b17214e8 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -19,9 +19,8 @@ platforms: - name: centos-7 - name: centos-8 - name: centos-stream-8 - - name: debian-9 - - name: debian-10 - name: debian-11 + - name: debian-12 - name: ubuntu-20.04 - name: ubuntu-22.04 - name: fedora-latest @@ -30,19 +29,19 @@ suites: - name: package run_list: - recipe[test::package] - - name: source-1.8 + - name: source-2.4 run_list: - - recipe[test::source-18] - - name: source-2.0 + - recipe[test::source_24] + - name: source_2.6 run_list: - - recipe[test::source-20] - - name: source-2.2 + - recipe[test::source_26] + - name: source_2.8 run_list: - - recipe[test::source-22] - - name: source-2.4 + - recipe[test::source_28] + - name: source_2.9 run_list: - - recipe[test::source-24] - - name: source-default + - recipe[test::source_29] + - name: source_default run_list: - recipe[test::source] - name: source_lua diff --git a/resources/config_global.rb b/resources/config_global.rb index 827f5c97..e74f319c 100644 --- a/resources/config_global.rb +++ b/resources/config_global.rb @@ -20,11 +20,11 @@ property :stats, Hash, default: lazy { - { - socket: "/var/run/haproxy.sock user #{user} group #{group}", - timeout: '2m', - } - }, + { + socket: "/var/run/haproxy.sock user #{user} group #{group}", + timeout: '2m', + } + }, description: 'Enable stats with various options' property :maxconn, [Integer, String], diff --git a/resources/install.rb b/resources/install.rb index f28c13d3..2b16a845 100644 --- a/resources/install.rb +++ b/resources/install.rb @@ -31,13 +31,13 @@ # Source property :source_version, String, - default: '2.2.4' + default: '2.8.5' property :source_url, String, default: lazy { "https://www.haproxy.org/download/#{source_version.to_f}/src/haproxy-#{source_version}.tar.gz" } property :source_checksum, String, - default: '87a4d9d4ff8dc3094cb61bbed4a8eed2c40b5ac47b9604daebaf036d7b541be2' + default: '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' property :source_target_cpu, String, default: lazy { node['kernel']['machine'] } diff --git a/test/cookbooks/test/recipes/config_array.rb b/test/cookbooks/test/recipes/config_array.rb index 59dc21b5..3aa9ed91 100644 --- a/test/cookbooks/test/recipes/config_array.rb +++ b/test/cookbooks/test/recipes/config_array.rb @@ -27,7 +27,8 @@ 'redirect' => [ 'prefix http://www.bar.com code 301 if { hdr(host) -i foo.com }', 'prefix http://www.bar.com code 301 if { hdr(host) -i www.foo.com }', - ]) + ] + ) default_backend 'servers' end diff --git a/test/cookbooks/test/recipes/source.rb b/test/cookbooks/test/recipes/source.rb index 415a4b5d..0920cb2c 100644 --- a/test/cookbooks/test/recipes/source.rb +++ b/test/cookbooks/test/recipes/source.rb @@ -2,9 +2,9 @@ haproxy_install 'source' -haproxy_config_global '' +haproxy_config_global -haproxy_config_defaults '' +haproxy_config_defaults haproxy_service 'haproxy' do action %i(create enable start) diff --git a/test/cookbooks/test/recipes/source-24.rb b/test/cookbooks/test/recipes/source_24.rb similarity index 58% rename from test/cookbooks/test/recipes/source-24.rb rename to test/cookbooks/test/recipes/source_24.rb index afcc652a..828efdd2 100644 --- a/test/cookbooks/test/recipes/source-24.rb +++ b/test/cookbooks/test/recipes/source_24.rb @@ -1,9 +1,9 @@ -apt_update +version '2.4.25' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/2.4/src/haproxy-2.4.0.tar.gz' - source_checksum '0a6962adaf5a1291db87e3eb4ddf906a72fed535dbd2255b164b7d8394a53640' - source_version '2.4.0' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum '44b035bdc9ffd4935f5292c2dfd4a1596c048dc59c5b25a0c6d7689d64f50b99' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-18.rb b/test/cookbooks/test/recipes/source_26.rb similarity index 55% rename from test/cookbooks/test/recipes/source-18.rb rename to test/cookbooks/test/recipes/source_26.rb index a7ec0903..56db527b 100644 --- a/test/cookbooks/test/recipes/source-18.rb +++ b/test/cookbooks/test/recipes/source_26.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.6.16' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/1.8/src/haproxy-1.8.17.tar.gz' - source_checksum '7b789b177875afdd5ddeff058e7efde73aa895dc2dcf728b464358635ae3948e' - source_version '1.8.17' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum 'faac6f9564caf6e106fe22c77a1fb35406afc8cd484c35c2c844aaf0d7a097fb' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-20.rb b/test/cookbooks/test/recipes/source_28.rb similarity index 56% rename from test/cookbooks/test/recipes/source-20.rb rename to test/cookbooks/test/recipes/source_28.rb index 3396e4dc..5a095d5f 100644 --- a/test/cookbooks/test/recipes/source-20.rb +++ b/test/cookbooks/test/recipes/source_28.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.8.5' haproxy_install 'source' do - source_url 'https://www.haproxy.org/download/2.0/src/haproxy-2.0.12.tar.gz' - source_checksum '7fcf5adb21cd78c4161902f9fcc8d7fc97e1562319a992cbda884436ca9602fd' - source_version '2.0.12' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source-22.rb b/test/cookbooks/test/recipes/source_29.rb similarity index 56% rename from test/cookbooks/test/recipes/source-22.rb rename to test/cookbooks/test/recipes/source_29.rb index 18c8d575..c8e83ae8 100644 --- a/test/cookbooks/test/recipes/source-22.rb +++ b/test/cookbooks/test/recipes/source_29.rb @@ -1,9 +1,9 @@ -apt_update +version = '2.9.3' haproxy_install 'source' do - source_url 'http://www.haproxy.org/download/2.2/src/haproxy-2.2.14.tar.gz' - source_checksum '6a9b702f04b07786f3e5878de8172a727acfdfdbc1cefe1c7a438df372f2fb61' - source_version '2.2.14' + source_url "https://www.haproxy.org/download/#{version.to_f}/src/haproxy-#{version}.tar.gz" + source_checksum 'ed517c65abd86945411f6bcb18c7ec657a706931cb781ea283063ba0a75858c0' + source_version version use_libcrypt true use_pcre true use_openssl true diff --git a/test/cookbooks/test/recipes/source_openssl.rb b/test/cookbooks/test/recipes/source_openssl.rb index c6f03d1a..ef2aaf02 100644 --- a/test/cookbooks/test/recipes/source_openssl.rb +++ b/test/cookbooks/test/recipes/source_openssl.rb @@ -70,7 +70,7 @@ # install haproxy with openssl haproxy_install 'source' do source_url 'http://www.haproxy.org/download/2.2/src/haproxy-2.2.4.tar.gz' - source_checksum '87a4d9d4ff8dc3094cb61bbed4a8eed2c40b5ac47b9604daebaf036d7b541be2' + source_checksum '3f5459c5a58e0b343a32eaef7ed5bed9d3fc29d8aa9e14b36c92c969fc2a60d9' source_version '2.2.4' use_openssl true use_zlib true diff --git a/test/integration/config_4/example_spec.rb b/test/integration/config_4/example_spec.rb index ce88640b..0d6f0d8b 100644 --- a/test/integration/config_4/example_spec.rb +++ b/test/integration/config_4/example_spec.rb @@ -95,7 +95,7 @@ ' reqirep \^Host:\\\ www.mydomain.com Host:\\\ www', ' default_backend servers', ] - its('content') { should match /#{cfg_content.join('\n')}/ } + its('content') { should match(/#{cfg_content.join('\n')}/) } end describe service('haproxy') do diff --git a/test/integration/source-2.4/source_spec.rb b/test/integration/source-2.4/source_spec.rb index 5e48884d..3b6e931a 100644 --- a/test/integration/source-2.4/source_spec.rb +++ b/test/integration/source-2.4/source_spec.rb @@ -13,5 +13,5 @@ end describe command('haproxy -vv') do - its('stdout') { should match /Built with the Prometheus exporter as a service/ } + its('stdout') { should match(/Built with the Prometheus exporter as a service/) } end diff --git a/test/integration/source-1.8/source_spec.rb b/test/integration/source_2.6/source_spec.rb similarity index 100% rename from test/integration/source-1.8/source_spec.rb rename to test/integration/source_2.6/source_spec.rb diff --git a/test/integration/source-2.0/source_spec.rb b/test/integration/source_2.8/source_spec.rb similarity index 100% rename from test/integration/source-2.0/source_spec.rb rename to test/integration/source_2.8/source_spec.rb diff --git a/test/integration/source_2.9/source_spec.rb b/test/integration/source_2.9/source_spec.rb new file mode 100644 index 00000000..fcbe218e --- /dev/null +++ b/test/integration/source_2.9/source_spec.rb @@ -0,0 +1,13 @@ +describe directory '/etc/haproxy' do + it { should exist } +end + +describe file '/etc/haproxy/haproxy.cfg' do + its(:mode) { should cmp '0640' } +end + +describe service 'haproxy' do + it { should be_installed } + it { should be_enabled } + it { should be_running } +end diff --git a/test/integration/source_lua/lua_spec.rb b/test/integration/source_lua/lua_spec.rb index 70c7c0f7..fe18209a 100644 --- a/test/integration/source_lua/lua_spec.rb +++ b/test/integration/source_lua/lua_spec.rb @@ -3,5 +3,5 @@ end describe command('haproxy -vv | grep Lua') do - its('stdout') { should match /Built with Lua version/ } + its('stdout') { should match(/Built with Lua version/) } end diff --git a/test/integration/source_openssl/openssl_spec.rb b/test/integration/source_openssl/openssl_spec.rb index ae9df196..1dabf783 100644 --- a/test/integration/source_openssl/openssl_spec.rb +++ b/test/integration/source_openssl/openssl_spec.rb @@ -7,5 +7,5 @@ end describe command('haproxy -vv | grep "OpenSSL 1.1.1h"') do - its('stdout') { should match /OpenSSL version : OpenSSL 1.1.1h 22 Sep 2020/ } + its('stdout') { should match(/OpenSSL version : OpenSSL 1.1.1h 22 Sep 2020/) } end